summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-07-16 07:40:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:28:38 -0500
commitc9da49790e67b6840c4cfa6daddfffbbe643d140 (patch)
treef4e5b1fbca3fb08ae0bf07bd3949a6bb4e3c0042 /source3
parentd537225c4c467e8bda6e8f45b69a64c16c5ecb58 (diff)
downloadsamba-c9da49790e67b6840c4cfa6daddfffbbe643d140.tar.gz
samba-c9da49790e67b6840c4cfa6daddfffbbe643d140.tar.bz2
samba-c9da49790e67b6840c4cfa6daddfffbbe643d140.zip
r23882: Fix Coverity id 389 -- finally (I hope)
(This used to be commit 9b8f2d8bd144700306819480bcb260d2c20969ae)
Diffstat (limited to 'source3')
-rw-r--r--source3/locking/brlock.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 228a30b7af..252728ced3 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1641,14 +1641,18 @@ static struct byte_range_lock *brl_get_locks_internal(TALLOC_CTX *mem_ctx,
talloc_set_destructor(br_lck, byte_range_lock_destructor);
br_lck->num_locks = data.dsize / sizeof(struct lock_struct);
- br_lck->lock_data = SMB_MALLOC_ARRAY(struct lock_struct, br_lck->num_locks);
- if ((br_lck->num_locks != 0) && (br_lck->lock_data == NULL)) {
- DEBUG(0, ("malloc failed\n"));
- TALLOC_FREE(br_lck);
- return NULL;
- }
- memcpy(br_lck->lock_data, data.dptr, data.dsize);
+ if (br_lck->num_locks != 0) {
+ br_lck->lock_data = SMB_MALLOC_ARRAY(struct lock_struct,
+ br_lck->num_locks);
+ if (br_lck->lock_data == NULL) {
+ DEBUG(0, ("malloc failed\n"));
+ TALLOC_FREE(br_lck);
+ return NULL;
+ }
+
+ memcpy(br_lck->lock_data, data.dptr, data.dsize);
+ }
if (!fsp->lockdb_clean) {
int orig_num_locks = br_lck->num_locks;