mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
ctdb-utils: CID 1273087 - Resource leak
Ensure that p is not leaked. This is a test program and the program exits anyway. No need to backport. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
32b5ceb319
commit
597039daeb
@ -153,8 +153,7 @@ static void ping_pong(int fd, int num_locks)
|
||||
ret = lock_range(fd, 0, 1, true);
|
||||
if (ret != 0) {
|
||||
printf("initial lock at 0 failed! - %s\n", strerror(errno));
|
||||
free(val);
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@ -167,8 +166,7 @@ static void ping_pong(int fd, int num_locks)
|
||||
if (do_check) {
|
||||
ret = check_lock(fd, i, 1);
|
||||
if (ret != 0) {
|
||||
free(val);
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (do_reads) {
|
||||
@ -209,6 +207,12 @@ static void ping_pong(int fd, int num_locks)
|
||||
}
|
||||
loops++;
|
||||
}
|
||||
|
||||
done:
|
||||
if (use_mmap) {
|
||||
munmap(p, num_locks+1);
|
||||
}
|
||||
free(val);
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
|
Loading…
Reference in New Issue
Block a user