Changeset: 0fc8db69ea4f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0fc8db69ea4f
Modified Files:
        monetdb5/modules/mal/txtsim.c
Branch: resource_management
Log Message:

initialize ma before goto's


diffs (30 lines):

diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -382,6 +382,7 @@ BATTXTSIMmaxlevenshtein(Client ctx, MalB
        size_t llen = 0, rlen = 0, maxlen = 0;
        int d;
        bit v;
+       allocator *ma = NULL;
 
        if ((left = BATdescriptor(*lid)) == NULL) {
                msg = createException(MAL, "battxtsim.maxlevenshtein",
@@ -407,7 +408,7 @@ BATTXTSIMmaxlevenshtein(Client ctx, MalB
        li = bat_iterator(left);
        ri = bat_iterator(right);
 
-       allocator *ma = MT_thread_getallocator();
+       ma = MT_thread_getallocator();
        allocator_state ma_state = ma_open(ma);
 
        BATloop(left, p, q) {
@@ -449,7 +450,8 @@ BATTXTSIMmaxlevenshtein(Client ctx, MalB
        *res = bn->batCacheid;
        BBPkeepref(bn);
   exit:
-       ma_close(ma, &ma_state);
+       if (ma)
+               ma_close(ma, &ma_state);
        BBPreclaim(left);
        BBPreclaim(right);
        if (msg != MAL_SUCCEED)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to