Fix coverity reported memory leaks

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2021-07-19 07:34:29 +03:00 committed by Dirk Hohndel
parent 63795a84f4
commit 48c2929f48

View file

@ -104,8 +104,10 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected)
* Get the i'th dive in XML format so we can process it. * Get the i'th dive in XML format so we can process it.
* We need to save to a file before we can reload it back into memory... * We need to save to a file before we can reload it back into memory...
*/ */
if (selected && !dive->selected) if (selected && !dive->selected) {
free_xml_params(params);
continue; continue;
}
/* make sure the buffer is empty and add the dive */ /* make sure the buffer is empty and add the dive */
mb.len = 0; mb.len = 0;
@ -151,6 +153,7 @@ bool uploadDiveLogsDE::prepareDives(const QString &tempfile, bool selected)
zip_close(zip); zip_close(zip);
QFile::remove(tempfile); QFile::remove(tempfile);
xsltFreeStylesheet(xslt); xsltFreeStylesheet(xslt);
free_xml_params(params);
return false; return false;
} }
free_buffer(&mb); free_buffer(&mb);