summaryrefslogtreecommitdiffstats
path: root/disk-utils
diff options
context:
space:
mode:
authorSami Kerola2014-11-11 22:34:30 +0100
committerKarel Zak2014-11-18 12:56:46 +0100
commitacec6eec4e29f5951bee5b5db9534566abec27bb (patch)
tree495d9fe12b9964f416cef3769bcf5271daed8c51 /disk-utils
parenttests: mark python libmount tests known to fail with AddressSanitizer (diff)
downloadkernel-qcow2-util-linux-acec6eec4e29f5951bee5b5db9534566abec27bb.tar.gz
kernel-qcow2-util-linux-acec6eec4e29f5951bee5b5db9534566abec27bb.tar.xz
kernel-qcow2-util-linux-acec6eec4e29f5951bee5b5db9534566abec27bb.zip
mkswap: remove memory leaks [LeakSanitizer] [valgrind]
==18922==ERROR: LeakSanitizer: detected memory leaks Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x49d12b in __interceptor_malloc (/home/src/util-linux/.libs/lt-mkswap+0x49d12b) #1 0x7faf2a5069c9 in __GI___strdup (/usr/lib/libc.so.6+0x819c9) #2 0xffff96e7e33 (<unknown module>) SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s). And another one that valgrind found. ==6316== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==6316== at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==6316== by 0x5E3F9C9: strdup (in /usr/lib/libc-2.20.so) ==6316== by 0x43A25F: size_to_human_string (strutils.c:495) ==6316== by 0x42B35C: main (mkswap.c:488) Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/mkswap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index c4fe8c92b..d34e2fd35 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -323,6 +323,7 @@ static void wipe_device(struct mkswap_control *ctl)
fprintf(stderr, _(" (compiled without libblkid). "));
fprintf(stderr, _("Use -f to force.\n"));
}
+ free(type);
#ifdef HAVE_LIBBLKID
blkid_free_probe(pr);
#endif
@@ -488,6 +489,7 @@ int main(int argc, char **argv)
printf(_("Setting up swapspace version %d, size = %s (%ju bytes)\n"),
version, strsz, sz);
+ free(strsz);
set_signature(&ctl);
set_uuid_and_label(&ctl);