From: Volker Lendecke Date: Thu, 19 Apr 2012 14:09:41 +0000 (+0200) Subject: s3: Fix Coverity ID 2682 -- NULL_RETURNS X-Git-Tag: samba-4.0.0alpha20~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=393936aee6f20d85ba2b3e6c59af7c6b8c554a28;p=thirdparty%2Fsamba.git s3: Fix Coverity ID 2682 -- NULL_RETURNS Autobuild-User: Volker Lendecke Autobuild-Date: Thu Apr 19 22:28:34 CEST 2012 on sn-devel-104 --- diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 463aa21fd82..557099b2d80 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -457,11 +457,18 @@ void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount) posix_pending_close_db, talloc_tos(), locking_ref_count_key_fsp(fsp, &tmp)); + if (rec == NULL) { + DEBUG(0, ("reduce_windows_lock_ref_count: rec not found\n")); + return; + } + value = dbwrap_record_get_value(rec); - SMB_ASSERT((rec != NULL) - && (value.dptr != NULL) - && (value.dsize == sizeof(lock_ref_count))); + if ((value.dptr == NULL) || (value.dsize != sizeof(lock_ref_count))) { + DEBUG(0, ("reduce_windows_lock_ref_count: wrong value\n")); + TALLOC_FREE(rec); + return; + } memcpy(&lock_ref_count, value.dptr, sizeof(lock_ref_count));