From eeaf1626262fbced3528b8ecbfc714a2bcf355f6 Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Tue, 8 Nov 2011 19:02:21 +0000 Subject: [PATCH] Add missing free() for line that is malloc()'d by getline(). --- libdm/ioctl/libdm-iface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index f28ed4873..a0fa6402a 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -172,7 +172,7 @@ static int _get_proc_number(const char *file, const char *name, { FILE *fl; char nm[256]; - char *line; + char *line = NULL; size_t len; uint32_t num; @@ -188,6 +188,7 @@ static int _get_proc_number(const char *file, const char *name, *number = num; if (fclose(fl)) log_sys_error("fclose", file); + free(line); return 1; } dm_bit_set(_dm_bitset, num); @@ -196,6 +197,7 @@ static int _get_proc_number(const char *file, const char *name, } if (fclose(fl)) log_sys_error("fclose", file); + free(line); if (number) { log_error("%s: No entry for %s found", file, name); -- 2.43.5