Changeset: 59a2f994dda1 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=59a2f994dda1 Modified Files: clients/mapiclient/ReadlineTools.c clients/mapiclient/dump.c clients/mapiclient/tomograph.c Branch: Jan2014 Log Message:
Coverity fixes. diffs (97 lines): diff --git a/clients/mapiclient/ReadlineTools.c b/clients/mapiclient/ReadlineTools.c --- a/clients/mapiclient/ReadlineTools.c +++ b/clients/mapiclient/ReadlineTools.c @@ -92,8 +92,9 @@ sql_tablename_generator(const char *text while (seekpos < rowcount) { const char *name; - mapi_seek_row(table_hdl, seekpos++, MAPI_SEEK_SET); - mapi_fetch_row(table_hdl); + if (mapi_seek_row(table_hdl, seekpos++, MAPI_SEEK_SET) != MOK || + mapi_fetch_row(table_hdl) <= 0) + continue; name = mapi_fetch_field(table_hdl, 0); if (strncmp(name, text, len) == 0) { char *s; diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -1938,8 +1938,6 @@ dump_database(Mapi mid, stream *toConsol return rc; bailout: - if( curschema ) - free(curschema); if (hdl) { if (mapi_result_error(hdl)) mapi_explain_result(hdl, stderr); @@ -1950,6 +1948,8 @@ dump_database(Mapi mid, stream *toConsol mapi_explain(mid, stderr); bailout2: + if (curschema) + free(curschema); hdl = mapi_query(mid, end); if (hdl) mapi_close_handle(hdl); diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c --- a/clients/mapiclient/tomograph.c +++ b/clients/mapiclient/tomograph.c @@ -1106,7 +1106,10 @@ showcolormap(char *filename, int all) if (all) { snprintf(buf, BUFSIZ, "%s.gpl", filename); f = fopen(buf, "w"); - assert(f); + if (f == NULL) { + fprintf(stderr, "Creating file %s.gpl failed\n", filename); + exit(1); + } fprintf(f, "set terminal pdfcairo noenhanced color solid size 8.3, 11.7\n"); fprintf(f, "set output \"%s.pdf\"\n", filename); fprintf(f, "set size 1,1\n"); @@ -1237,6 +1240,10 @@ showcolormap(char *filename, int all) fprintf(f, "\" at %d,%d\n", (int) (0.2 * w), h - 35); fprintf(f, "plot 0 notitle with lines linecolor rgb \"white\"\n"); + if (all) { + assert(f != gnudata); + fclose(f); + } } static void @@ -1296,7 +1303,10 @@ keepdata(char *filename) return; snprintf(buf, BUFSIZ, "%s.trace", filename); f = fopen(buf, "w"); - assert(f); + if (f == NULL) { + fprintf(stderr, "Creating file %s.trace failed\n", filename); + exit(1); + } for (i = 0; i < topbox; i++) if (box[i].clkend && box[i].fcn) { @@ -1855,8 +1865,10 @@ parser(char *row) /* find genuine function calls */ while (isspace((int) *fcn) && *fcn) fcn++; - if (strchr(fcn, '.') == 0) + if (strchr(fcn, '.') == 0) { + free(stmt); return -10; + } } else { fcn = strchr(fcn, '"'); if (fcn) { @@ -2149,6 +2161,10 @@ stop_cleanup: doQ("profiler.stop();"); doQ("profiler.closeStream();"); stop_disconnect: + if (dbhsql) { + mapi_disconnect(dbhsql); + mapi_destroy(dbhsql); + } if (wthr->dbh) { mapi_disconnect(wthr->dbh); mapi_destroy(wthr->dbh); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list