Changeset: e382b65c91b9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e382b65c91b9
Modified Files:
        sql/backends/monet5/sql.c
Branch: nested
Log Message:

fix bat leak


diffs (27 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5766,7 +5766,7 @@ insert_json_object(char **msg, JSON *js,
                }
        }
 
-       if (elm > 0 && BUNappend(bats[w], &id, false) != GDK_SUCCEED)
+       if (t->multiset && elm > 0 && BUNappend(bats[w], &id, false) != 
GDK_SUCCEED)
                elm = -3;
        if (t->multiset == MS_ARRAY && elm > 0 && BUNappend(bats[w+1], &anr, 
false) != GDK_SUCCEED)
                elm = -3;
@@ -5853,10 +5853,13 @@ SQLfrom_json(Client cntxt, MalBlkPtr mb,
                BUN p, q;
                BATloop(b, p, q) {
                        const char *json = (const char *) BUNtail(bi, p);
-                       if ((msg = insert_json_str(json, bats, pci->retc, t )) 
!= MAL_SUCCEED)
+                       if ((msg = insert_json_str(json, bats, pci->retc, t )) 
!= MAL_SUCCEED) {
+                               BBPreclaim(b);
                                goto bailout;
+                       }
                }
                bat_iterator_end(&bi);
+               BBPreclaim(b);
        } else {
                if (strcmp(BATatoms[mtype].name, "json") != 0)
                        throw(SQL, "SQLfrom_json", SQLSTATE(HY013) "Incorrect 
argument type");
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to