Changeset: ced7106e3dfb for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ced7106e3dfb
Modified Files:
        sql/backends/monet5/UDF/capi/capi.c
Branch: jitudf
Log Message:

Properly free input bats.


diffs (36 lines):

diff --git a/sql/backends/monet5/UDF/capi/capi.c 
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -434,6 +434,8 @@ static str CUDFeval(Client cntxt, MalBlk
        int bat_type = 0;
        const char* tpe = NULL;
 
+       size_t extra_inputs = 0;
+
        (void)cntxt;
 
        actual_mprotected_regions[tid] = &regions;
@@ -901,7 +903,7 @@ static str CUDFeval(Client cntxt, MalBlk
        }
        if (input_count > 0) {
                // add "aggr_group" for non-grouped aggregates
-               size_t extra_inputs = non_grouped_aggregate ? 1 : 0;
+               extra_inputs = non_grouped_aggregate ? 1 : 0;
                input_bats = GDKzalloc(sizeof(BAT *) * (input_count + 
extra_inputs));
                inputs = GDKzalloc(sizeof(void *) * (input_count + 
extra_inputs));
                if (!inputs || !input_bats) {
@@ -1485,6 +1487,14 @@ wrapup:
                }
                GDKfree(output_names);
        }
+       if (input_bats) {
+               for(i = 0; i < input_count + extra_inputs; i++) {
+                       if (input_bats[i]) {
+                               BBPunfix(input_bats[i]->batCacheid);
+                       }
+               }
+               GDKfree(input_bats);
+       }
        // input data
        if (inputs) {
                for (i = 0; i < (size_t)input_count; i++) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to