mirror of
https://github.com/samba-team/samba.git
synced 2025-01-07 17:18:11 +03:00
s3:g_lock: avoid useless talloc_array(0) in g_lock_dump()
In the common case we don't have any shared lock holders, so there's no need to allocate memory for the empty array. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
bb3dddcdf1
commit
c75de32571
@ -1238,12 +1238,14 @@ static void g_lock_dump_fn(TDB_DATA key, TDB_DATA data,
|
||||
return;
|
||||
}
|
||||
|
||||
shared = talloc_array(
|
||||
state->mem_ctx, struct server_id, lck.num_shared);
|
||||
if (shared == NULL) {
|
||||
DBG_DEBUG("talloc failed\n");
|
||||
state->status = NT_STATUS_NO_MEMORY;
|
||||
return;
|
||||
if (lck.num_shared > 0) {
|
||||
shared = talloc_array(
|
||||
state->mem_ctx, struct server_id, lck.num_shared);
|
||||
if (shared == NULL) {
|
||||
DBG_DEBUG("talloc failed\n");
|
||||
state->status = NT_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<lck.num_shared; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user