diff options
author | Karel Zak | 2010-06-16 23:41:33 +0200 |
---|---|---|
committer | Karel Zak | 2010-06-16 23:41:33 +0200 |
commit | 770af396fa31ca9c56807d58f407eb2d3d4060b6 (patch) | |
tree | fc040f70138725287ec53793ae885a77c44899f3 /misc-utils/wipefs.c | |
parent | wipefs: fix mem usage (diff) | |
download | kernel-qcow2-util-linux-770af396fa31ca9c56807d58f407eb2d3d4060b6.tar.gz kernel-qcow2-util-linux-770af396fa31ca9c56807d58f407eb2d3d4060b6.tar.xz kernel-qcow2-util-linux-770af396fa31ca9c56807d58f407eb2d3d4060b6.zip |
wipefs: fix memory leaks
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/wipefs.c')
-rw-r--r-- | misc-utils/wipefs.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index 1db72fd1c..c0b29f0ec 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -303,6 +303,23 @@ do_wipe(struct wipe_desc *wp, const char *fname, int noact) return 0; } +static void +free_wipe(struct wipe_desc *wp) +{ + while (wp) { + struct wipe_desc *next = wp->next; + + free(wp->usage); + free(wp->type); + free(wp->magic); + free(wp->label); + free(wp->uuid); + free(wp); + + wp = next; + } +} + static loff_t strtoll_offset(const char *str) { @@ -391,6 +408,8 @@ main(int argc, char **argv) do_wipe(wp, fname, noact); else print_all(wp, mode); + + free_wipe(wp); } return EXIT_SUCCESS; } |