summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-12-11 00:53:28 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-11 03:13:30 +0100
commit01fdd2876a1b5d447fc08498f5b32f482dd9e716 (patch)
tree493e9b9af4d1c69626ba1eab93e20b628d87fc1a /profile.c
parentedfa3ba810f500c293eade993829e11f37145922 (diff)
downloadsubsurface-01fdd2876a1b5d447fc08498f5b32f482dd9e716.tar.gz
Plug memory leaks in compare_samples
Free temporary buffer before returning. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/profile.c b/profile.c
index 6e3019729..8d9100bd6 100644
--- a/profile.c
+++ b/profile.c
@@ -1344,8 +1344,10 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int
if (bufsize > 0)
buf[0] = '\0';
- if (e1 == NULL || e2 == NULL)
+ if (e1 == NULL || e2 == NULL) {
+ free(buf2);
return;
+ }
if (e1->sec < e2->sec) {
start = e1;
@@ -1354,6 +1356,7 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int
start = e2;
stop = e1;
} else {
+ free(buf2);
return;
}
count = 0;