From 268f4a8f7e81d8b32591e01b6dbcdca0bee1322f Mon Sep 17 00:00:00 2001 From: Grant Erickson Date: Mon, 31 Jan 2011 15:56:54 +0100 Subject: stats: Fix double free error The error appears when stats_file_remap() fails. --- src/stats.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/stats.c') diff --git a/src/stats.c b/src/stats.c index 0dc45f06..929e09bf 100644 --- a/src/stats.c +++ b/src/stats.c @@ -222,10 +222,18 @@ static void stats_free(gpointer user_data) TFR(close(file->fd)); file->fd = -1; - if (file->history_name != NULL) + if (file->history_name != NULL) { g_free(file->history_name); - g_free(file->name); - g_free(file); + file->history_name = NULL; + } + + if (file->name != NULL) { + g_free(file->name); + file->name = NULL; + } + + if (file != NULL) + g_free(file); } static void update_first(struct stats_file *file) -- cgit v1.2.3