ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL)
[amitay/samba.git] / ctdb / utils / ping_pong / ping_pong.c
index be43a1d704d24c3043cf4a402bb3a16899275293..f7f2eb1ed164ab39d21e61cd87767ad6feead5c9 100644 (file)
@@ -142,7 +142,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;
        }