Changeset: 7d17cae390e5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7d17cae390e5
Modified Files:
        monetdb5/modules/atoms/json.c
        monetdb5/modules/mal/pcre.c
Branch: Oct2014
Log Message:

Resource leaks.


diffs (47 lines):

diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -486,6 +486,7 @@ JSONglue(str res, str r, char sep)
                        strncpy(n + l, r, len);
                        n[l + len] = 0;
                }
+               GDKfree(res);
                res = n;
        }
        if (r)
@@ -510,7 +511,7 @@ JSONmatch(JSON *jt, int ji, pattern * te
        case JSON_ARRAY:
                if (terms[ti].name != 0 && terms[ti].token != ANY_STEP) {
                        if (terms[ti].token == END_STEP)
-                               r = JSONgetValue(jt, ji);
+                               res = JSONgetValue(jt, ji);
                        return res;
                }
                cnt = 0;
@@ -793,7 +794,9 @@ JSONtoken(JSON *jt, char *j, char **next
                jt->elm[idx].valuelen = *next - jt->elm[idx].value;
                return idx;
        case '"':
-               JSONstringParser(j + 1, next, silent);
+               msg = JSONstringParser(j + 1, next, silent);
+               if (!silent)
+                       jt->error = msg;
                jt->elm[idx].kind = JSON_STRING;
                jt->elm[idx].value = j;
                jt->elm[idx].valuelen = *next - j;
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -715,8 +715,11 @@ pcre_replace_bat(BAT **res, BAT *origin_
 
        assert(origin_strs->htype==TYPE_void);
        tmpbat = BATnew(origin_strs->htype, TYPE_str, BATcount(origin_strs), 
TRANSIENT);
-       if( tmpbat==NULL)
+       if( tmpbat==NULL) {
+               my_pcre_free(pcre_code);
+               GDKfree(ovector);
                throw(MAL,"pcre.replace",MAL_MALLOC_FAIL);
+       }
        BATloop(origin_strs, p, q) {
                origin_str = BUNtail(origin_strsi, p);
                len_origin_str = (int) strlen(origin_str);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to