[tracker] Fixed src/libstemmer/libstemmer.c coverity failures



commit 66a549d6e4da72e84d41df6b1f229dd0ad35242b
Author: Martyn Russell <martyn imendio com>
Date:   Wed May 13 15:05:33 2009 +0100

    Fixed src/libstemmer/libstemmer.c coverity failures
---
 src/libstemmer/libstemmer.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/libstemmer/libstemmer.c b/src/libstemmer/libstemmer.c
index d7b5953..d8b8c8c 100644
--- a/src/libstemmer/libstemmer.c
+++ b/src/libstemmer/libstemmer.c
@@ -53,12 +53,20 @@ sb_stemmer_new(const char * algorithm, const char * charenc)
 	    (struct sb_stemmer *) malloc(sizeof(struct sb_stemmer));
     if (stemmer == NULL) return NULL;
     enc = sb_getenc(charenc);
-    if (enc == ENC_UNKNOWN) return NULL;
+    if (enc == ENC_UNKNOWN) 
+    {
+            free(stemmer);
+            return NULL;
+    }
 
     for (module = modules; module->name != 0; module++) {
 	if (strcmp(module->name, algorithm) == 0 && module->enc == enc) break;
     }
-    if (module->name == NULL) return NULL;
+    if (module->name == NULL) 
+    {
+            free(stemmer);
+            return NULL;
+    }
 
     stemmer->create = module->create;
     stemmer->close = module->close;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]