diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-10 20:43:43 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-10 20:43:43 +0100 |
commit | 9d3c08e633b70fbc236cc8e197732ba32f9fc5cb (patch) | |
tree | 16f54bf3dd4b28da689931cbd06a30ada4d5ff80 /src/mds-kbdc/tree.c | |
parent | mds-kbdc: add support for return, continue and break (diff) | |
download | mds-9d3c08e633b70fbc236cc8e197732ba32f9fc5cb.tar.gz mds-9d3c08e633b70fbc236cc8e197732ba32f9fc5cb.tar.bz2 mds-9d3c08e633b70fbc236cc8e197732ba32f9fc5cb.tar.xz |
memory leak
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-kbdc/tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mds-kbdc/tree.c b/src/mds-kbdc/tree.c index 600bf2a..99fa223 100644 --- a/src/mds-kbdc/tree.c +++ b/src/mds-kbdc/tree.c @@ -63,6 +63,9 @@ static void mds_kbdc_tree_destroy_(mds_kbdc_tree_t* restrict this, int recursive #define xfree(t, v) (free(V(t, v)), V(t, v) = NULL) #define xdestroy(t, v) (recursive ? (mds_kbdc_tree_destroy_(V(t, v), 1), xfree(t, v)) : (V(t, v) = NULL)) + mds_kbdc_tree_t* prev = NULL; + mds_kbdc_tree_t* first = this; + again: if (this == NULL) return; @@ -149,7 +152,10 @@ static void mds_kbdc_tree_destroy_(mds_kbdc_tree_t* restrict this, int recursive break; } + prev = this; this = this->next; + if (prev != first) + free(prev); goto again; #undef xdestroy |