git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c46c6e2
)
r6238: Ensure if realloc fails on an internal
author
Jeremy Allison
<jra@samba.org>
Thu, 7 Apr 2005 19:50:54 +0000
(19:50 +0000)
committer
Gerald (Jerry) Carter
<jerry@samba.org>
Wed, 10 Oct 2007 18:11:28 +0000
(13:11 -0500)
tdb we fail gracefully.
Jeremy.
(This used to be commit
d69f7c05468ae54e0474b188fedabe14e7297d53
)
source4/lib/tdb/common/tdb.c
patch
|
blob
|
history
diff --git
a/source4/lib/tdb/common/tdb.c
b/source4/lib/tdb/common/tdb.c
index d9fabaeda9195c6de606646f70a25eb23fb0b256..6554ec5697aec7224f113abd61d4d780ac838f51 100644
(file)
--- a/
source4/lib/tdb/common/tdb.c
+++ b/
source4/lib/tdb/common/tdb.c
@@
-802,9
+802,14
@@
static int tdb_expand(TDB_CONTEXT *tdb, tdb_off size)
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