summaryrefslogtreecommitdiff
path: root/pith/hist.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-06-16 00:36:14 -0600
committerEduardo Chappa <chappa@washington.edu>2018-06-16 00:36:14 -0600
commit19dfafb6bc3ed0d37036f21813b753a4dca91e52 (patch)
tree72ee32d9026dae4d1afb6e349f00375f9f207afe /pith/hist.c
parent6fc06defd55e7d00f620d40e52da47bc4c1b3a96 (diff)
downloadalpine-19dfafb6bc3ed0d37036f21813b753a4dca91e52.tar.xz
* Fix freeing history memory, and other changes to make Valgrind happy.
Diffstat (limited to 'pith/hist.c')
-rw-r--r--pith/hist.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pith/hist.c b/pith/hist.c
index bef5598b..8f21b831 100644
--- a/pith/hist.c
+++ b/pith/hist.c
@@ -50,8 +50,12 @@ free_hist(HISTORY_S **history)
if(history && *history){
for(i = 0; i < (*history)->histsize; i++)
- if((*history)->hist[i] && (*history)->hist[i]->str)
- fs_give((void **) &(*history)->hist[i]->str);
+ if((*history)->hist[i]){
+ if((*history)->hist[i]->str)
+ fs_give((void **) &(*history)->hist[i]->str);
+ (*history)->hist[i]->cntxt = NULL; /* taken care of elsewhere */
+ fs_give((void **) &(*history)->hist[i]);
+ }
fs_give((void **) history);
}