summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Thomas <rrt@sc3d.org>2020-08-22 09:25:43 +0100
committerGitHub <noreply@github.com>2020-08-22 09:25:43 +0100
commitcb8c758626e87eea0da4e0e89acc02ec4d2b1566 (patch)
tree4f45234da90ce595a6930f944f103113f8a153d0
parent583e9e8a408536be6db0a9d217ba5c5217bc78f9 (diff)
parent2e8b0afb244eee803a4f5a3023b210b84c1a243b (diff)
downloadenchant-cb8c758626e87eea0da4e0e89acc02ec4d2b1566.tar.gz
Merge pull request #249 from rrthomas/masterv2.2.9
Fix a couple of space leaks
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml29
-rw-r--r--NEWS6
-rw-r--r--build-aux/.gitignore15
-rwxr-xr-xbuild-aux/travis-build.sh17
-rw-r--r--configure.ac2
-rw-r--r--providers/enchant_nuspell.cpp10
7 files changed, 61 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index e9230ef..ea15854 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/NEWS b/NEWS
index f3bf072..03618e8 100644
--- a/NEWS
+++ b/NEWS
@@ -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