aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Thiago Macieira <thiago@macieira.org>2013-12-11 17:56:31 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-12 03:35:46 +0100
commitb3d59cb89080d519f5629c224cf6359f80640e19 (patch)
treedf89f5ac24b471f4b47268ae2ca10100bec2387e /qt-ui
parent04ec3cf31f4ff29c18381cddf22259604de7cb97 (diff)
downloadsubsurface-b3d59cb89080d519f5629c224cf6359f80640e19.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/subsurfacewebservices.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 6be63fbad..2b51da8d6 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -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;
}