From: Martin Schwenke Date: Wed, 27 Jul 2016 07:43:34 +0000 (+1000) Subject: ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL) X-Git-Tag: samba-4.3.12~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a864c91e9d281d28559e56abfecce7b3bdece42;p=thirdparty%2Fsamba.git ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL) BUG: https://bugzilla.samba.org/show_bug.cgi?id=12110 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit d46960f20e795cd4abc1c727705f77b2f0e0e564) --- diff --git a/ctdb/utils/ping_pong/ping_pong.c b/ctdb/utils/ping_pong/ping_pong.c index fdb575daae2..aec3ff03dca 100644 --- a/ctdb/utils/ping_pong/ping_pong.c +++ b/ctdb/utils/ping_pong/ping_pong.c @@ -141,7 +141,9 @@ static void ping_pong(int fd, int num_locks) val = (unsigned char *)calloc(num_locks+1, sizeof(unsigned char)); if (val == NULL) { printf("calloc failed\n"); - munmap(p, num_locks+1); + if (use_mmap) { + munmap(p, num_locks+1); + } return; }