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>
(cherry picked from commit
c75de325710c0fbbd50a0acd3af55404165440d6)
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++) {