1
0
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 used to be commit 28772dfca1)
This commit is contained in:
Jeremy Allison 2005-04-07 19:39:34 +00:00 committed by Gerald (Jerry) Carter
parent d761233aba
commit e79e98a9f6

View File

@ -832,9 +832,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