about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-02-07 11:00:10 +0000
committerEric Wong <normalperson@yhbt.net>2013-02-07 11:00:10 +0000
commitc3550946c61a43cad54f1aa7c0f0f062a451042f (patch)
tree6407b159efc9fd04049db4be5b5da9d02172c97e
parent03bf577eb3a328f130083d992b180ba72ee1f0b4 (diff)
downloadcmogstored-c3550946c61a43cad54f1aa7c0f0f062a451042f.tar.gz
This is not strictly necessary as this memory is freed anyways,
but stop valgrind from complaining and avoid unnecessary
suppressions (since shutdown performance is not important).
-rw-r--r--process.c7
-rw-r--r--upgrade.c18
2 files changed, 25 insertions, 0 deletions
diff --git a/process.c b/process.c
index 0fb26a4..e817fba 100644
--- a/process.c
+++ b/process.c
@@ -25,6 +25,13 @@ static size_t process_hash(const void *x, size_t tablesize)
         return p->pid % tablesize;
 }
 
+/* needed to make valgrind happy */
+__attribute__((destructor)) static void process_atexit(void)
+{
+        if (processes)
+                hash_free(processes);
+}
+
 /* call before forking */
 void mog_process_init(size_t nr)
 {
diff --git a/upgrade.c b/upgrade.c
index 3dc7975..4083b25 100644
--- a/upgrade.c
+++ b/upgrade.c
@@ -10,6 +10,24 @@ static struct {
         char **envp;
 } start;
 
+MOG_NOINLINE static void free_list(char **head)
+{
+        char **tmp = head;
+
+        if (tmp) {
+                for (; *tmp; tmp++)
+                        free(*tmp);
+                free(head);
+        }
+}
+
+/* only needed to make valgrind happy */
+__attribute__((destructor)) static void upgrade_atexit(void)
+{
+        free_list(start.argv);
+        free_list(start.envp);
+}
+
 void mog_upgrade_prepare(int argc, char *argv[], char *envp[])
 {
         int i;