mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r6235: Partial fix for bugid #2581. Ensure if realloc fails on an internal
tdb we fail gracefully. Jeremy.
This commit is contained in:
parent
dbf021a2e0
commit
28772dfca1
@ -832,9 +832,14 @@ static int tdb_expand(TDB_CONTEXT *tdb, tdb_off size)
|
|||||||
|
|
||||||
tdb->map_size += size;
|
tdb->map_size += size;
|
||||||
|
|
||||||
if (tdb->flags & TDB_INTERNAL)
|
if (tdb->flags & TDB_INTERNAL) {
|
||||||
tdb->map_ptr = realloc(tdb->map_ptr, tdb->map_size);
|
char *new_map_ptr = realloc(tdb->map_ptr, tdb->map_size);
|
||||||
else {
|
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
|
* We must ensure the file is remapped before adding the space
|
||||||
* to ensure consistency with systems like OpenBSD where
|
* to ensure consistency with systems like OpenBSD where
|
||||||
|
Loading…
Reference in New Issue
Block a user