Changeset: 486302255075 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=486302255075
Modified Files:
clients/mapiclient/mclient.c
clients/odbc/driver/SQLBrowseConnect.c
monetdb5/mal/mal_function.c
Branch: Jun2016
Log Message:
Coverity inspired fixes.
diffs (114 lines):
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2011,6 +2011,7 @@ doFileBulk(Mapi mid, stream *fp)
if (hdl == NULL)
break; /* nothing more to do */
buf[0] = 0;
+ length = 0; /* handle error like EOF */
} else {
buf[length] = 0;
if (strlen(buf) < (size_t) length) {
@@ -3046,13 +3047,16 @@ main(int argc, char **argv)
break;
#ifdef HAVE_ICONV
case 'E':
+ assert(optarg);
encoding = optarg;
break;
#endif
case 'L':
+ assert(optarg);
logfile = strdup(optarg);
break;
case 'l':
+ assert(optarg);
/* accept unambiguous prefix of language */
if (strcmp(optarg, "sql") == 0 ||
strcmp(optarg, "sq") == 0 ||
@@ -3075,15 +3079,18 @@ main(int argc, char **argv)
}
break;
case 'n':
+ assert(optarg);
nullstring = optarg;
break;
case 'u':
+ assert(optarg);
if (user)
free(user);
user = strdup(optarg);
user_set_as_flag = 1;
break;
case 'f':
+ assert(optarg);
if (output != NULL)
free(output);
output = strdup(optarg); /* output format */
@@ -3105,9 +3112,11 @@ main(int argc, char **argv)
}
break;
case 'h':
+ assert(optarg);
host = optarg;
break;
case 'p':
+ assert(optarg);
port = atoi(optarg);
break;
case 'D':
@@ -3117,20 +3126,25 @@ main(int argc, char **argv)
useinserts = 1;
break;
case 'd':
+ assert(optarg);
dbname = optarg;
break;
case 's':
+ assert(optarg);
command = optarg;
break;
case 'w':
+ assert(optarg);
pagewidth = atoi(optarg);
pagewidthset = pagewidth != 0;
break;
case 'r':
+ assert(optarg);
rowsperpage = atoi(optarg);
break;
#ifdef HAVE_POPEN
case '|':
+ assert(optarg);
pager = optarg;
break;
#endif
diff --git a/clients/odbc/driver/SQLBrowseConnect.c
b/clients/odbc/driver/SQLBrowseConnect.c
--- a/clients/odbc/driver/SQLBrowseConnect.c
+++ b/clients/odbc/driver/SQLBrowseConnect.c
@@ -164,8 +164,11 @@ MNDBBrowseConnect(ODBCDbc *dbc,
/* if not set from InConnectionString argument
* or environment, look in profile */
n = SQLGetPrivateProfileString(dsn, "logfile", "", buf,
sizeof(buf), "odbc.ini");
- if (n > 0 && buf[0])
+ if (n > 0 && buf[0]) {
+ if (ODBCdebug)
+ free((void *) ODBCdebug); /* discard
const */
ODBCdebug = strdup(buf);
+ }
}
#endif
}
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -1033,7 +1033,8 @@ showFlowGraph(MalBlkPtr mb, MalStkPtr st
oline = line;
}
free(buf);
- } else if (f != GDKout) {
+ }
+ if (f != GDKout) {
if (!stethoscope ) {
MT_sleep_ms(4000); /* delay for stethoscope */
close_stream(f);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list