Changeset: 70e6ec13877d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/70e6ec13877d Modified Files: sql/backends/monet5/sql.c Branch: default Log Message:
Fix a leak. Calling buffer_wastream with a non-NULL buffer argument does not give away the buffer, so it still needs to be destroyed. Calling buffer_get_buf returns a to-be-freed buffer (and it can fail). diffs (28 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 @@ -5562,16 +5562,22 @@ SQLread_dump_rel(Client cntxt, MalBlkPtr rel_print_(m, s, rel, 0, refs, 0); res = buffer_get_buf(b); + if (res == NULL) + goto bailout; if (!(*r = GDKstrdup(res))) goto bailout; - mnstr_destroy(s); + free(res); + close_stream(s); + buffer_destroy(b); return MAL_SUCCEED; bailout: + if (res) + free(res); if (s) mnstr_destroy(s); - else if (b) + if (b) buffer_destroy(b); throw(SQL, "SQLread_dump_rel", SQLSTATE(HY013) MAL_MALLOC_FAIL); } _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org