diff options
author | Reuben Thomas <rrt@sc3d.org> | 2020-08-22 09:25:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 09:25:43 +0100 |
commit | cb8c758626e87eea0da4e0e89acc02ec4d2b1566 (patch) | |
tree | 4f45234da90ce595a6930f944f103113f8a153d0 | |
parent | 583e9e8a408536be6db0a9d217ba5c5217bc78f9 (diff) | |
parent | 2e8b0afb244eee803a4f5a3023b210b84c1a243b (diff) | |
download | enchant-cb8c758626e87eea0da4e0e89acc02ec4d2b1566.tar.gz |
Merge pull request #249 from rrthomas/masterv2.2.9
Fix a couple of space leaks
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 29 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | build-aux/.gitignore | 15 | ||||
-rwxr-xr-x | build-aux/travis-build.sh | 17 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | providers/enchant_nuspell.cpp | 10 |
7 files changed, 61 insertions, 19 deletions
@@ -12,7 +12,6 @@ Makefile Makefile.in /aclocal.m4 /autom4te.cache -/build-aux /compile /configure /config.* diff --git a/.travis.yml b/.travis.yml index e125715..47ce66d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ +os: linux language: cpp - dist: bionic addons: @@ -17,27 +17,28 @@ addons: - libunittest++-dev - hunspell-fr - libnuspell-dev + homebrew: + # Note: aspell should work on macOS, but has been removed because one of + # the tests fails; see https://github.com/Homebrew/homebrew-core/issues/4097 + packages: + - glib + - dbus-glib + - hspell + - hunspell + - libvoikko + - unittest-cpp + update: true env: global: - VERBOSE=1 # Get test logs in Travis logs -matrix: +jobs: include: - os: linux env: - - CONFIGURE_ARGS=("CFLAGS=\"-g3 -fsanitize=address -fsanitize=undefined\"" "LDFLAGS=\"-fsanitize=address -fsanitize=undefined\"") + - ASAN=yes - os: osx -before_install: - # Note: aspell should work on macOS, but has been removed from the next - # line because one of the tests fails; see - # https://github.com/Homebrew/homebrew-core/issues/40976 - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install dbus-glib hspell hunspell libvoikko unittest-cpp ; fi - script: - - ./bootstrap - - ./configure --enable-relocatable --with-zemberek=check "${CONFIGURE_ARGS[@]}" - - make - - make distcheck - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo locale-gen fr_FR.UTF-8; env LANG=fr_FR.UTF-8 make check ; fi + - ./build-aux/travis-build.sh @@ -1,3 +1,9 @@ +2.2.9 (July 29, 2020) +--------------------- + +Fix a couple of space leaks in the Nuspell back end (thanks, ASAN). + + 2.2.8 (February 27, 2020) ------------------------- diff --git a/build-aux/.gitignore b/build-aux/.gitignore new file mode 100644 index 0000000..9d4ab69 --- /dev/null +++ b/build-aux/.gitignore @@ -0,0 +1,15 @@ +/bootstrap.in +/compile +/config.guess +/config.sub +/depcomp +/extract-trace +/funclib.sh +/inline-source +/install-sh +/ltmain.sh +/mdate-sh +/missing +/options-parser +/test-driver +/texinfo.tex diff --git a/build-aux/travis-build.sh b/build-aux/travis-build.sh new file mode 100755 index 0000000..371326b --- /dev/null +++ b/build-aux/travis-build.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Build on Travis +# Written by Reuben Thomas 2020. +# This file is in the public domain. + +set -e + +./bootstrap +CONFIGURE_ARGS=(--enable-relocatable --with-zemberek=check) +if [[ "$ASAN" == "yes" ]]; then + CONFIGURE_ARGS+=(CFLAGS="-g3 -fsanitize=address -fsanitize=undefined" LDFLAGS="-fsanitize=address -fsanitize=undefined") +fi +./configure --enable-silent-rules "${CONFIGURE_ARGS[@]}" +make +make distcheck + +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo locale-gen fr_FR.UTF-8; env LANG=fr_FR.UTF-8 make check ; fi diff --git a/configure.ac b/configure.ac index 23eb3f2..af388ca 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([enchant],[2.2.8]) +AC_INIT([enchant],[2.2.9]) AC_CONFIG_SRCDIR(src/enchant.h) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([subdir-objects]) diff --git a/providers/enchant_nuspell.cpp b/providers/enchant_nuspell.cpp index e97a3d3..1f10918 100644 --- a/providers/enchant_nuspell.cpp +++ b/providers/enchant_nuspell.cpp @@ -74,8 +74,9 @@ NuspellChecker::checkWord(const char *utf8Word, size_t len) { // the 8-bit encodings use precomposed forms char *normalizedWord = g_utf8_normalize (utf8Word, len, G_NORMALIZE_NFC); - - return nuspell.spell(string(normalizedWord)); + string s(normalizedWord); + g_free(normalizedWord); + return nuspell.spell(s); } char** @@ -83,8 +84,10 @@ NuspellChecker::suggestWord(const char* const utf8Word, size_t len, size_t *nsug { // the 8-bit encodings use precomposed forms char *normalizedWord = g_utf8_normalize (utf8Word, len, G_NORMALIZE_NFC); + string s(normalizedWord); + g_free(normalizedWord); auto suggestions = vector<string>(); - nuspell.suggest(string(normalizedWord), suggestions); + nuspell.suggest(s, suggestions); if (suggestions.empty()) return nullptr; *nsug = suggestions.size(); @@ -254,6 +257,7 @@ NuspellChecker::requestDictionary(const char *szLang) if (!s_fileExists(aff)) return false; auto path = string(dic); + free(dic); if (path.size() >= 4 && path.compare(path.size() - 4, 4, ".dic") == 0) path.erase(path.size() - 4); else |