Changeset: 9e202e24dff8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9e202e24dff8
Modified Files:
clients/mapiclient/mclient.c
clients/mapilib/mapi.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_logger.c
sql/backends/monet5/bam/bam_loader.c
Branch: default
Log Message:
Merge with Oct2014 branch.
diffs (167 lines):
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1897,6 +1897,7 @@ doFileBulk(Mapi mid, FILE *fp)
}
if (hdl == NULL)
break; /* nothing more to do */
+ buf[0] = 0;
} else {
if (first &&
length >= UTF8BOMLENGTH &&
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1490,6 +1490,8 @@ new_result(MapiHdl hdl)
printf("allocating new result set\n");
/* append a newly allocated struct to the end of the linked list */
result = malloc(sizeof(*result));
+ if (result == NULL)
+ return NULL;
result->next = NULL;
if (hdl->lastresult == NULL)
hdl->result = hdl->lastresult = result;
@@ -1735,7 +1737,6 @@ mapi_new_handle(Mapi mid)
mapi_check0(mid, "mapi_new_handle");
hdl = malloc(sizeof(*hdl));
- assert(hdl);
if (hdl == NULL) {
mapi_setError(mid, "Memory allocation failure",
"mapi_new_handle", MERROR);
return NULL;
@@ -1893,6 +1894,10 @@ mapi_new(void)
mid->tracelog = NULL;
mid->blk.eos = 0;
mid->blk.buf = malloc(BLOCK + 1);
+ if (mid->blk.buf == NULL) {
+ mapi_destroy(mid);
+ return NULL;
+ }
mid->blk.buf[BLOCK] = 0;
mid->blk.buf[0] = 0;
mid->blk.nxt = 0;
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -236,10 +236,12 @@ BATnewstorage(int ht, int tt, BUN cap, i
BATstore *bs;
BAT *bn;
- assert(cap <= BUN_MAX);
/* and in case we don't have assertions enabled: limit the size */
- if (cap > BUN_MAX)
+ if (cap > BUN_MAX) {
+ /* shouldn't happen, but if it does... */
+ assert(0);
cap = BUN_MAX;
+ }
bs = BATcreatedesc(ht, tt, (ht || tt), role);
if (bs == NULL)
return NULL;
@@ -3040,9 +3042,10 @@ BATderiveHeadProps(BAT *b, int expensive
BUN hb, prb;
oid sqbs = oid_nil;
- assert(b != NULL);
- if (b == NULL)
+ if (b == NULL) {
+ assert(0);
return;
+ }
assert((b->hkey & BOUND2BTRUE) == 0);
COLsettrivprop(b, b->H);
cmpf = ATOMcompare(b->htype);
@@ -3242,10 +3245,10 @@ BATderiveHeadProps(BAT *b, int expensive
void
BATderiveProps(BAT *b, int expensive)
{
- assert(b != NULL);
-
- if (b == NULL)
+ if (b == NULL) {
+ assert(0);
return;
+ }
BATderiveHeadProps(b, expensive);
if (b->H != b->T)
BATderiveHeadProps(BATmirror(b), expensive);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1272,7 +1272,7 @@ gdk_return
BATsubsort(BAT **sorted, BAT **order, BAT **groups,
BAT *b, BAT *o, BAT *g, int reverse, int stable)
{
- BAT *bn = NULL, *on = NULL, *gn = NULL;
+ BAT *bn = NULL, *on = NULL, *gn;
oid *restrict grps, prev;
BUN p, q, r;
@@ -1499,8 +1499,6 @@ BATsubsort(BAT **sorted, BAT **order, BA
BBPunfix(bn->batCacheid);
if (on)
BBPreclaim(on);
- if (gn)
- BBPreclaim(gn);
if (sorted)
*sorted = NULL;
if (order)
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1617,6 +1617,7 @@ logger_exit(logger *lg)
char ext[BUFSIZ];
if (fprintf(fp, "%06d\n\n", lg->version) < 0) {
+ (void) fclose(fp);
fprintf(stderr, "!ERROR: logger_exit: write to %s
failed\n",
filename);
return LOG_ERR;
@@ -1624,13 +1625,20 @@ logger_exit(logger *lg)
lg->id ++;
if (logger_commit(lg) != LOG_OK) {
+ (void) fclose(fp);
fprintf(stderr, "!ERROR: logger_exit: logger_commit
failed\n");
return LOG_ERR;
}
- if (fprintf(fp, LLFMT "\n", lg->id) < 0 ||
- fclose(fp) < 0) {
- fprintf(stderr, "!ERROR: logger_exit: write/flush to %s
failed\n",
+ if (fprintf(fp, LLFMT "\n", lg->id) < 0) {
+ (void) fclose(fp);
+ fprintf(stderr, "!ERROR: logger_exit: write to %s
failed\n",
+ filename);
+ return LOG_ERR;
+ }
+
+ if (fclose(fp) < 0) {
+ fprintf(stderr, "!ERROR: logger_exit: flush of %s
failed\n",
filename);
return LOG_ERR;
}
diff --git a/sql/backends/monet5/bam/bam_loader.c
b/sql/backends/monet5/bam/bam_loader.c
--- a/sql/backends/monet5/bam/bam_loader.c
+++ b/sql/backends/monet5/bam/bam_loader.c
@@ -281,14 +281,13 @@ bam_loader(Client cntxt, MalBlkPtr mb, s
for (i = 0; i < nr_files; ++i) {
TO_LOG("<bam_loader> Creating alignment tables for file
'%s'...\n", filenames[i]);
if ((dbschema == 0
- && create_alignment_storage_0(cntxt,
- "bam.create_storage_0",
- bws + i) != MAL_SUCCEED)
+ && (msg = create_alignment_storage_0(cntxt,
+
"bam.create_storage_0",
+ bws + i)) !=
MAL_SUCCEED)
|| (dbschema == 1
- && create_alignment_storage_1(cntxt,
-
"bam.create_storage_1",
- bws + i) !=
- MAL_SUCCEED)) {
+ && (msg = create_alignment_storage_1(cntxt,
+
"bam.create_storage_1",
+ bws + i)) !=
MAL_SUCCEED)) {
goto cleanup;
}
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list