summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-14 16:57:07 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-14 16:57:07 +0000
commit4c0a9cfe95004f1fc934b69aa65cf2bd8a3f46ac (patch)
treec0f797d426c1adb622574d64cc7a6875b4c07d9a /plugins
parent657e6203b0435e74d91d1e756eb55dd9729f447e (diff)
fix for two mem leaks in hunspell
git-svn-id: http://svn.miranda-ng.org/main/trunk@12820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SpellChecker/src/hunspell/affixmgr.cxx5
-rw-r--r--plugins/SpellChecker/src/hunspell/csutil.cxx59
2 files changed, 35 insertions, 29 deletions
diff --git a/plugins/SpellChecker/src/hunspell/affixmgr.cxx b/plugins/SpellChecker/src/hunspell/affixmgr.cxx
index bd998f6369..6f2ae6ccdd 100644
--- a/plugins/SpellChecker/src/hunspell/affixmgr.cxx
+++ b/plugins/SpellChecker/src/hunspell/affixmgr.cxx
@@ -312,7 +312,10 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
utf8 = 1;
#ifndef OPENOFFICEORG
#ifndef MOZILLA_CLIENT
- if (initialize_utf_tbl()) return 1;
+ if (initialize_utf_tbl()) {
+ finishFileMgr(afflst);
+ return 1;
+ }
#endif
#endif
}
diff --git a/plugins/SpellChecker/src/hunspell/csutil.cxx b/plugins/SpellChecker/src/hunspell/csutil.cxx
index ee78edbc40..86b75242ef 100644
--- a/plugins/SpellChecker/src/hunspell/csutil.cxx
+++ b/plugins/SpellChecker/src/hunspell/csutil.cxx
@@ -339,34 +339,37 @@ int line_tok(const char * text, char *** lines, char breakchar) {
}
// uniq line in place
-char * line_uniq(char * text, char breakchar) {
- char ** lines;
- int linenum = line_tok(text, &lines, breakchar);
- int i;
-
- if (linenum == 0)
- return NULL;
- strcpy(text, lines[0]);
- for ( i = 1; i < linenum; i++ ) {
- int dup = 0;
- for (int j = 0; j < i; j++) {
- if (strcmp(lines[i], lines[j]) == 0) {
- dup = 1;
- break;
- }
- }
- if (!dup) {
- if ((i > 1) || (*(lines[0]) != '\0')) {
- sprintf(text + strlen(text), "%c", breakchar);
- }
- strcat(text, lines[i]);
- }
- }
- for ( i = 0; i < linenum; i++ ) {
- if (lines[i]) free(lines[i]);
- }
- if (lines) free(lines);
- return text;
+char * line_uniq(char * text, char breakchar)
+{
+ char **lines;
+ int linenum = line_tok(text, &lines, breakchar);
+ int i;
+
+ if (linenum == 0)
+ text = NULL;
+ else {
+ strcpy(text, lines[0]);
+ for (i = 1; i < linenum; i++) {
+ int dup = 0;
+ for (int j = 0; j < i; j++) {
+ if (strcmp(lines[i], lines[j]) == 0) {
+ dup = 1;
+ break;
+ }
+ }
+ if (!dup) {
+ if ((i > 1) || (*(lines[0]) != '\0')) {
+ sprintf(text + strlen(text), "%c", breakchar);
+ }
+ strcat(text, lines[i]);
+ }
+ }
+ }
+ for (i = 0; i < linenum; i++) {
+ if (lines[i]) free(lines[i]);
+ }
+ if (lines) free(lines);
+ return text;
}
// uniq and boundary for compound analysis: "1\n\2\n\1" -> " ( \1 | \2 ) "