Changeset: 0db23ac1d990 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0db23ac1d990
Modified Files:
MonetDB/src/gdk/gdk_bat.mx
MonetDB5/src/mal/mal_function.mx
MonetDB5/src/mal/mal_instruction.mx
MonetDB5/src/mal/mal_profiler.mx
Branch: default
Log Message:
Merge from Jun2010 branch: Hardening: check for allocation failures and stuff
like that.
diffs (91 lines):
diff -r f35835c337d4 -r 0db23ac1d990 MonetDB/src/gdk/gdk_bat.mx
--- a/MonetDB/src/gdk/gdk_bat.mx Mon Jul 05 12:29:45 2010 +0200
+++ b/MonetDB/src/gdk/gdk_bat.mx Mon Jul 05 12:31:17 2010 +0200
@@ -102,6 +102,8 @@
@c
BATstore *bs = (BATstore *) GDKzalloc(sizeof(BATstore));
+ if (bs == NULL)
+ return NULL;
@-
assert needed in the kernel to get symbol eprintf resolved.
Else modules using assert fail to load.
diff -r f35835c337d4 -r 0db23ac1d990 MonetDB5/src/mal/mal_box.mx
--- a/MonetDB5/src/mal/mal_box.mx Mon Jul 05 12:29:45 2010 +0200
+++ b/MonetDB5/src/mal/mal_box.mx Mon Jul 05 12:31:17 2010 +0200
@@ -599,12 +599,13 @@
int i;
b = BATnew(TYPE_int, TYPE_str, (BUN) MAXSPACES);
+ if (b == NULL)
+ throw(MAL, "box.getBoxNames", MAL_MALLOC_FAIL);
for (i = 0; i < topbox; i++)
if (malbox[i] != NULL) {
BUNins(b, &i, malbox[i]->name, FALSE);
}
- BBPincref(*bid = b->batCacheid, TRUE);
- BBPunfix(*bid);
+ BBPkeepref(*bid = b->batCacheid);
return MAL_SUCCEED;
}
diff -r f35835c337d4 -r 0db23ac1d990 MonetDB5/src/mal/mal_function.mx
--- a/MonetDB5/src/mal/mal_function.mx Mon Jul 05 12:29:45 2010 +0200
+++ b/MonetDB5/src/mal/mal_function.mx Mon Jul 05 12:31:17 2010 +0200
@@ -115,7 +115,11 @@
InstrPtr p;
s = newSymbol(nme,kind);
+ if (s == NULL)
+ return NULL;
p = newInstruction(NULL,kind);
+ if (p == NULL)
+ return NULL;
setModuleId(p, mod);
setFunctionId(p, nme);
setDestVar(p, newVariable(s->def,GDKstrdup(nme),TYPE_any));
@@ -125,6 +129,8 @@
InstrPtr newCall(Module scope, str fcnname, int kind){
InstrPtr p;
p= newInstruction(NULL,kind);
+ if (p == NULL)
+ return NULL;
setModuleScope(p, scope);
setFunctionId(p, putName(fcnname,strlen(fcnname)));
return p;
diff -r f35835c337d4 -r 0db23ac1d990 MonetDB5/src/mal/mal_instruction.mx
--- a/MonetDB5/src/mal/mal_instruction.mx Mon Jul 05 12:29:45 2010 +0200
+++ b/MonetDB5/src/mal/mal_instruction.mx Mon Jul 05 12:31:17 2010 +0200
@@ -600,7 +600,7 @@
}
cur = (Symbol) GDKzalloc(sizeof(SymRecord));
if (cur == NULL) {
- GDKerror("@1:"MAL_MALLOC_FAIL);
+ GDKerror("newSymbol:"MAL_MALLOC_FAIL);
return NULL;
}
cur->name = putName(nme,strlen(nme));
@@ -990,6 +990,8 @@
}
if (p == NULL) {
p = GDKzalloc(MAXARG * sizeof(p->maxarg) + sizeof(InstrRecord));
+ if (p == NULL)
+ return NULL;
p->maxarg = MAXARG;
}
p->typechk = TYPE_UNKNOWN;
diff -r f35835c337d4 -r 0db23ac1d990 MonetDB5/src/mal/mal_profiler.mx
--- a/MonetDB5/src/mal/mal_profiler.mx Mon Jul 05 12:29:45 2010 +0200
+++ b/MonetDB5/src/mal/mal_profiler.mx Mon Jul 05 12:31:17 2010 +0200
@@ -1033,10 +1033,10 @@
}
b = BATnew(TYPE_void, tt, 1 << 16);
- BATseqbase(b, 0);
if (b == NULL)
return NULL;
+ BATseqbase(b, 0);
BATkey(b, TRUE);
BBPrename(b->batCacheid, buf);
BATmode(b, PERSISTENT);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list