svn commit: samba r6236 - in trunk/source/tdb: .
jra at samba.org
jra at samba.org
Thu Apr 7 19:40:26 GMT 2005
Author: jra
Date: 2005-04-07 19:40:20 +0000 (Thu, 07 Apr 2005)
New Revision: 6236
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6236
Log:
Partial fix for bugid #2581. Ensure if realloc fails on an internal
tdb we fail gracefully.
Jeremy.
Modified:
trunk/source/tdb/tdb.c
Changeset:
Modified: trunk/source/tdb/tdb.c
===================================================================
--- trunk/source/tdb/tdb.c 2005-04-07 19:39:34 UTC (rev 6235)
+++ trunk/source/tdb/tdb.c 2005-04-07 19:40:20 UTC (rev 6236)
@@ -832,9 +832,14 @@
tdb->map_size += size;
- if (tdb->flags & TDB_INTERNAL)
- tdb->map_ptr = realloc(tdb->map_ptr, tdb->map_size);
- else {
+ if (tdb->flags & TDB_INTERNAL) {
+ char *new_map_ptr = realloc(tdb->map_ptr, tdb->map_size);
+ if (!new_map_ptr) {
+ tdb->map_size -= size;
+ goto fail;
+ }
+ tdb->map_ptr = new_map_ptr;
+ } else {
/*
* We must ensure the file is remapped before adding the space
* to ensure consistency with systems like OpenBSD where
More information about the samba-cvs
mailing list