mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 03:23:24 +00:00
Don't leak the buffer or temporary file used to save the dive
Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
04ec3cf31f
commit
b3d59cb890
1 changed files with 3 additions and 0 deletions
|
@ -155,6 +155,8 @@ static char *prepare_dives_for_divelogs(const bool selected)
|
|||
membuf = (char *)malloc(streamsize + 1);
|
||||
if (!membuf || !fread(membuf, streamsize, 1, f)) {
|
||||
qDebug() << errPrefix << "memory error";
|
||||
fclose(f);
|
||||
free((void *)membuf);
|
||||
free((void *)tempfile);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -168,6 +170,7 @@ static char *prepare_dives_for_divelogs(const bool selected)
|
|||
doc = xmlReadMemory(membuf, strlen(membuf), "divelog", NULL, 0);
|
||||
if (!doc) {
|
||||
qDebug() << errPrefix << "xml error";
|
||||
free((void *)membuf);
|
||||
free((void *)tempfile);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue