]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL)
authorMartin Schwenke <martin@meltin.net>
Wed, 27 Jul 2016 07:43:34 +0000 (17:43 +1000)
committerKarolin Seeger <kseeger@samba.org>
Wed, 10 Aug 2016 09:37:23 +0000 (11:37 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12110

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit d46960f20e795cd4abc1c727705f77b2f0e0e564)

ctdb/utils/ping_pong/ping_pong.c

index fdb575daae29c305c12d978024e01b32580f53bc..aec3ff03dca195e4841f8573e7acb55dcc5e82c8 100644 (file)
@@ -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;
        }