From: Ben Pfaff Date: Thu, 27 Jun 2013 05:56:16 +0000 (-0700) Subject: session: Fix two memory leaks. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0755b9a4256554906377f2db62e25ac09255a790;p=pspp session: Fix two memory leaks. Bug #39070. --- diff --git a/src/data/session.c b/src/data/session.c index 56aa31a91c..ae37c76b94 100644 --- a/src/data/session.c +++ b/src/data/session.c @@ -69,6 +69,7 @@ session_destroy (struct session *s) s->active = NULL; HMAPX_FOR_EACH_SAFE (ds, node, next, &s->datasets) dataset_destroy (ds); + hmapx_destroy (&s->datasets); free (s->syntax_encoding); free (s); } @@ -96,7 +97,10 @@ session_add_dataset (struct session *s, struct dataset *ds) if (old == s->active) s->active = ds; if (old != NULL) - session_remove_dataset (s, old); + { + session_remove_dataset (s, old); + dataset_destroy (old); + } hmapx_insert (&s->datasets, ds, utf8_hash_case_string (dataset_name (ds), 0));