Changeset: ef81b6c9d84f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ef81b6c9d84f Modified Files: tools/monetdbe/monetdbe.c tools/monetdbe/monetdbe_mapi.c Branch: default Log Message:
initialize the structure properly diffs (67 lines): diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c --- a/tools/monetdbe/monetdbe.c +++ b/tools/monetdbe/monetdbe.c @@ -184,7 +184,7 @@ monetdbe_cleanup_result_internal(monetdb Client c = (Client) dbhdl; mvc *m = NULL; - assert(!res->dbhdl || res->dbhdl == dbhdl); + assert(!res || !res->dbhdl || res->dbhdl == dbhdl); if ((msg = validate_database_handle(dbhdl, "monetdbe.monetdbe_cleanup_result_internal")) != MAL_SUCCEED) return msg; if ((msg = getSQLContext(c, NULL, &m, NULL)) != MAL_SUCCEED) @@ -570,9 +570,8 @@ monetdbe_dump_database(monetdbe_database return msg; //The dbhdl is invalid, there is no transaction going } MT_lock_unset(&embedded_lock); - struct MapiStruct mid; + struct MapiStruct mid = { .mdbe = dbhdl }; - mid.mdbe = dbhdl; /* open file stream */ stream *fd = open_wastream(filename); if (fd) { @@ -598,9 +597,8 @@ monetdbe_dump_table(monetdbe_database db return msg; //The dbhdl is invalid, there is no transaction going } MT_lock_unset(&embedded_lock); - struct MapiStruct mid; + struct MapiStruct mid = { .mdbe = dbhdl }; - mid.mdbe = dbhdl; /* open file stream */ stream *fd = open_wastream(filename); if (fd) { diff --git a/tools/monetdbe/monetdbe_mapi.c b/tools/monetdbe/monetdbe_mapi.c --- a/tools/monetdbe/monetdbe_mapi.c +++ b/tools/monetdbe/monetdbe_mapi.c @@ -40,18 +40,20 @@ MapiMsg mapi_close_handle(MapiHdl hdl) { if (hdl) { - if (hdl->mapi_row) { - for (size_t i=0; i<hdl->result->ncols; i++) { - if (hdl->mapi_row[i]) - MAPIfree(hdl->mapi_row[i]); + char *msg = NULL; + if (hdl->result) { + if (hdl->mapi_row) { + for (size_t i=0; i<hdl->result->ncols; i++) { + if (hdl->mapi_row[i]) + MAPIfree(hdl->mapi_row[i]); + } + MAPIfree(hdl->mapi_row); } - MAPIfree(hdl->mapi_row); + msg = monetdbe_cleanup_result(hdl->mid->mdbe, hdl->result); + if (msg) + hdl->mid->msg = msg; } - - char *msg = monetdbe_cleanup_result(hdl->mid->mdbe, hdl->result); MAPIfree(hdl); - if (msg) - hdl->mid->msg = msg; } return MOK; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list