On 01/28/2011 10:39 PM, Grant Erickson wrote:
diff -aruN a/src/stats.c b/src/stats.c
--- a/src/stats.c       2011-01-28 13:20:49.248299633 -0800
+++ b/src/stats.c       2011-01-28 13:19:44.824306025 -0800
@@ -223,10 +223,18 @@
        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);
  }

I think the last check (file != NULL) is not necessary, because we do derefence it several times above.

cheers,
daniel
_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to