Changeset: 73423ad93bf8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=73423ad93bf8
Modified Files:
sql/backends/monet5/UDF/pyapi/conversion.c
Branch: default
Log Message:
Fix memory leak.
diffs (30 lines):
diff --git a/sql/backends/monet5/UDF/pyapi/conversion.c
b/sql/backends/monet5/UDF/pyapi/conversion.c
--- a/sql/backends/monet5/UDF/pyapi/conversion.c
+++ b/sql/backends/monet5/UDF/pyapi/conversion.c
@@ -851,6 +851,8 @@ str ConvertFromSQLType(BAT *b, sql_subty
if (conv_type == TYPE_str) {
BATiter li = bat_iterator(b);
BUN p = 0, q = 0;
+ char *result = NULL;
+ int length = 0;
int (*strConversion) (str*, int*, const void*) =
BATatoms[b->ttype].atomToStr;
*ret_bat = COLnew(0, TYPE_str, 0, TRANSIENT);
*ret_type = conv_type;
@@ -858,14 +860,15 @@ str ConvertFromSQLType(BAT *b, sql_subty
return createException(MAL, "pyapi.eval",
MAL_MALLOC_FAIL" string conversion BAT.");
}
BATloop(b, p, q) {
- char *result = NULL;
- int length = 0;
void *element = (void*) BUNtail(li, p);
if (strConversion(&result, &length, element) == 0) {
return createException(MAL, "pyapi.eval",
"Failed to convert element to string.");
}
BUNappend(*ret_bat, result, FALSE);
}
+ if (result) {
+ GDKfree(result);
+ }
return res;
}
else if (conv_type == TYPE_dbl)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list