Update of /cvsroot/monetdb/MonetDB5/src/modules/kernel
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4963
Modified Files:
bat5.mx
Log Message:
Same issues as previous check-in. Deal with the return of BATins
properly, avoiding an accidental free.
Index: bat5.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/kernel/bat5.mx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- bat5.mx 11 Sep 2007 20:20:41 -0000 1.21
+++ bat5.mx 11 Sep 2007 21:30:51 -0000 1.22
@@ -1850,7 +1850,7 @@
str
BKCinsert_bat(int *r, int *bid, int *sid)
{
- BAT *b, *s;
+ BAT *b, *bn, *s;
(void) r;
if ((b = BATdescriptor(*bid)) == NULL) {
@@ -1860,20 +1860,20 @@
BBPreleaseref(b->batCacheid);
throw(MAL, "bat.insert", "Cannot access descriptor");
}
- if (BATins(b, s,FALSE) == NULL) {
+ bn= BATins(b, s, FALSE);
+ BBPreleaseref(s->batCacheid);
+ if(bn == NULL) {
BBPreleaseref(b->batCacheid);
- BBPreleaseref(s->batCacheid);
throw(MAL, "bat.insert", "Failed");
}
- BBPreleaseref(b->batCacheid);
- BBPreleaseref(s->batCacheid);
+ BBPkeepref(*r=b->batCacheid);
return MAL_SUCCEED;
}
str
BKCinsert_bat_force(int *r, int *bid, int *sid, bit *force)
{
- BAT *b, *s;
+ BAT *bn,*b, *s;
(void) r;
if ((b = BATdescriptor(*bid)) == NULL) {
@@ -1883,13 +1883,13 @@
BBPreleaseref(b->batCacheid);
throw(MAL, "bat.insert", "Cannot access descriptor");
}
- if (BATins(b, s, *force) == NULL) {
+ bn= BATins(b, s, *force);
+ BBPreleaseref(s->batCacheid);
+ if(bn == NULL) {
BBPreleaseref(b->batCacheid);
- BBPreleaseref(s->batCacheid);
throw(MAL, "bat.insert", "Failed");
}
- BBPreleaseref(b->batCacheid);
- BBPreleaseref(s->batCacheid);
+ BBPkeepref(*r=b->batCacheid);
return MAL_SUCCEED;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins