diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-02-07 11:00:10 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-02-07 11:00:10 +0000 |
commit | c3550946c61a43cad54f1aa7c0f0f062a451042f (patch) | |
tree | 6407b159efc9fd04049db4be5b5da9d02172c97e | |
parent | 03bf577eb3a328f130083d992b180ba72ee1f0b4 (diff) | |
download | cmogstored-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.c | 7 | ||||
-rw-r--r-- | upgrade.c | 18 |
2 files changed, 25 insertions, 0 deletions
@@ -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) { @@ -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; |