Changeset: aae98bfa7501 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aae98bfa7501
Modified Files:
clients/odbc/driver/ODBCConvert.c
sql/backends/monet5/sql_scenario.c
Branch: Jan2014
Log Message:
Fix some potential resource leaks.
diffs (36 lines):
diff --git a/clients/odbc/driver/ODBCConvert.c
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -2711,6 +2711,8 @@ ODBCFetch(ODBCStmt *stmt,
char *b = realloc(buf, buflen += 1024); \
if (b == NULL) { \
free(buf); \
+ if (ctype == SQL_C_WCHAR && sval) \
+ free(sval); \
/* Memory allocation error */ \
addStmtError(stmt, "HY001", NULL, 0); \
return SQL_ERROR; \
@@ -2727,6 +2729,8 @@ ODBCFetch(ODBCStmt *stmt,
char *b = realloc(buf, buflen += 1024); \
if (b == NULL) { \
free(buf); \
+ if (ctype == SQL_C_WCHAR && sval) \
+ free(sval); \
/* Memory allocation error */ \
addStmtError(stmt, "HY001", NULL, 0); \
return SQL_ERROR; \
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1549,8 +1549,10 @@ SQLinclude(Client cntxt, MalBlkPtr mb, M
throw(MAL, "sql.include", "could not open file: %s\n", *name);
}
bfd = bstream_create(fd, 128 * BLOCK);
- if (bstream_next(bfd) < 0)
+ if (bstream_next(bfd) < 0) {
+ bstream_destroy(bfd);
throw(MAL, "sql.include", "could not read %s\n", *name);
+ }
expr = &bfd->buf;
msg = SQLstatementIntern(cntxt, expr, "sql.include", TRUE, FALSE);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list