mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
edfa3ba810
commit
01fdd2876a
1 changed files with 4 additions and 1 deletions
|
@ -1344,8 +1344,10 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int
|
||||||
|
|
||||||
if (bufsize > 0)
|
if (bufsize > 0)
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
if (e1 == NULL || e2 == NULL)
|
if (e1 == NULL || e2 == NULL) {
|
||||||
|
free(buf2);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e1->sec < e2->sec) {
|
if (e1->sec < e2->sec) {
|
||||||
start = e1;
|
start = e1;
|
||||||
|
@ -1354,6 +1356,7 @@ void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int
|
||||||
start = e2;
|
start = e2;
|
||||||
stop = e1;
|
stop = e1;
|
||||||
} else {
|
} else {
|
||||||
|
free(buf2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
Loading…
Reference in a new issue