clang: Fix Null pointer passed as argument warning
authorNoel Power <noel.power@suse.com>
Thu, 13 Jun 2019 13:39:22 +0000 (13:39 +0000)
committerNoel Power <npower@samba.org>
Wed, 26 Jun 2019 10:30:23 +0000 (10:30 +0000)
Fixes:
lib/tdb/common/transaction.c:354:2: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang]
        memcpy(tdb->transaction->blocks[blk] + off, buf, len);
&

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/tdb/common/transaction.c

index b67f84f215d8beca87ff0a01ffe93adc0a1aab79..290451b328555d25fd1398637e66c2da5eca50eb 100644 (file)
@@ -330,7 +330,7 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off,
                }
        }
 
-       if (len == 0) {
+       if (len == 0 || buf == NULL) {
                return 0;
        }