svn commit: samba r23755 - in branches: SAMBA_3_0/source/locking SAMBA_3_0_26/source/locking

vlendec at samba.org vlendec at samba.org
Mon Jul 9 07:51:39 GMT 2007


Author: vlendec
Date: 2007-07-09 07:51:39 +0000 (Mon, 09 Jul 2007)
New Revision: 23755

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23755

Log:
Fix Coverity id 384

Modified:
   branches/SAMBA_3_0/source/locking/brlock.c
   branches/SAMBA_3_0_26/source/locking/brlock.c


Changeset:
Modified: branches/SAMBA_3_0/source/locking/brlock.c
===================================================================
--- branches/SAMBA_3_0/source/locking/brlock.c	2007-07-09 03:08:20 UTC (rev 23754)
+++ branches/SAMBA_3_0/source/locking/brlock.c	2007-07-09 07:51:39 UTC (rev 23755)
@@ -1642,7 +1642,13 @@
 	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->lock_data = SMB_MALLOC_ARRAY(
+		      struct lock_struct, br_lck->num_locks))) {
+		DEBUG(0, ("malloc failed\n"));
+		TALLOC_FREE(br_lck);
+		return NULL;
+	}
+
 	memcpy(br_lck->lock_data, data.dptr, data.dsize);
 	
 	if (!fsp->lockdb_clean) {

Modified: branches/SAMBA_3_0_26/source/locking/brlock.c
===================================================================
--- branches/SAMBA_3_0_26/source/locking/brlock.c	2007-07-09 03:08:20 UTC (rev 23754)
+++ branches/SAMBA_3_0_26/source/locking/brlock.c	2007-07-09 07:51:39 UTC (rev 23755)
@@ -1642,7 +1642,13 @@
 	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->lock_data = SMB_MALLOC_ARRAY(
+		      struct lock_struct, br_lck->num_locks))) {
+		DEBUG(0, ("malloc failed\n"));
+		TALLOC_FREE(br_lck);
+		return NULL;
+	}
+
 	memcpy(br_lck->lock_data, data.dptr, data.dsize);
 	
 	if (!fsp->lockdb_clean) {



More information about the samba-cvs mailing list