Changeset: 8d58695d35fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8d58695d35fe
Modified Files:
        gdk/gdk_strimps.c
Branch: string_imprints
Log Message:

De-allocate the histogram correctly in case we bail out early


diffs (29 lines):

diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -321,18 +321,18 @@ STRMPbuildHeader(BAT *b, BAT *s, CharPai
        }
        bat_iterator_end(&bi);
 
-       // Check that we did record something in the histogram.
+       // Check that we have enough values in the histogram.
        if(values >= STRIMP_HEADER_SIZE) {
                // Choose the header pairs
                STRMPchoosePairs(hist, hlen, hpairs);
-               for (hidx = 0; hidx < hlen; hidx++) {
-                       if (hist[hidx].p) {
-                               GDKfree(hist[hidx].p);
-                               hist[hidx].p = NULL;
-                       }
+       }
+
+       for (hidx = 0; hidx < hlen; hidx++) {
+               if (hist[hidx].p) {
+                       GDKfree(hist[hidx].p);
+                       hist[hidx].p = NULL;
                }
        }
-
        GDKfree(hist);
 
        TRC_DEBUG(ACCELERATOR, LLFMT " usec\n", GDKusec() - t0);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to