diff options
Diffstat (limited to 'lib/ntdb/lock.c')
-rw-r--r-- | lib/ntdb/lock.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/ntdb/lock.c b/lib/ntdb/lock.c index 625a2c4934..95824db742 100644 --- a/lib/ntdb/lock.c +++ b/lib/ntdb/lock.c @@ -387,10 +387,16 @@ static enum NTDB_ERROR ntdb_nest_lock(struct ntdb_context *ntdb, "ntdb_nest_lock: already have a hash lock?"); } #endif - - new_lck = (struct ntdb_lock *)realloc( - ntdb->file->lockrecs, - sizeof(*ntdb->file->lockrecs) * (ntdb->file->num_lockrecs+1)); + if (ntdb->file->lockrecs == NULL) { + new_lck = ntdb->alloc_fn(ntdb->file, sizeof(*ntdb->file->lockrecs), + ntdb->alloc_data); + } else { + new_lck = (struct ntdb_lock *)ntdb->expand_fn( + ntdb->file->lockrecs, + sizeof(*ntdb->file->lockrecs) + * (ntdb->file->num_lockrecs+1), + ntdb->alloc_data); + } if (new_lck == NULL) { return ntdb_logerr(ntdb, NTDB_ERR_OOM, NTDB_LOG_ERROR, "ntdb_nest_lock:" |