From 9275be383f63441e45ead925c8956b2d1a7768b1 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sat, 3 Oct 2015 10:48:46 +0100 Subject: [PATCH] glocalfile: Fix memory leak in find_topdir_for() Coverity CID 1325398. --- gio/glocalfile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 60b95609e..45023a3e9 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -1705,13 +1705,17 @@ static char * find_topdir_for (const char *file) { char *dir; + char *mountpoint = NULL; dev_t dir_dev; dir = get_parent (file, &dir_dev); if (dir == NULL) return NULL; - return find_mountpoint_for (dir, dir_dev); + mountpoint = find_mountpoint_for (dir, dir_dev); + g_free (dir); + + return mountpoint; } static char *