mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
r6238: Ensure if realloc fails on an internal
tdb we fail gracefully.
Jeremy.
(This used to be commit d69f7c0546
)
This commit is contained in:
parent
c46c6e23ba
commit
e3775ee850
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user