diff options
author | Grant Erickson <marathon96@gmail.com> | 2011-01-31 15:56:54 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-01-31 15:56:54 +0100 |
commit | 268f4a8f7e81d8b32591e01b6dbcdca0bee1322f (patch) | |
tree | 46fd01760d03c1cb89edaa79894abacbe341b33e /src/stats.c | |
parent | 700eddf5224b0826ffb58aa90813e7fc503534a4 (diff) | |
download | connman-268f4a8f7e81d8b32591e01b6dbcdca0bee1322f.tar.gz connman-268f4a8f7e81d8b32591e01b6dbcdca0bee1322f.tar.bz2 connman-268f4a8f7e81d8b32591e01b6dbcdca0bee1322f.zip |
stats: Fix double free error
The error appears when stats_file_remap() fails.
Diffstat (limited to 'src/stats.c')
-rw-r--r-- | src/stats.c | 14 |
1 files changed, 11 insertions, 3 deletions
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) |