mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't leak the zip structure if no dives are selected
Just move the check above the zip_open call. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1b5b562da8
commit
aadf2cd19c
1 changed files with 6 additions and 6 deletions
|
@ -100,6 +100,12 @@ static void clear_table(struct dive_table *table)
|
||||||
|
|
||||||
static char *prepare_dives_for_divelogs(const bool selected)
|
static char *prepare_dives_for_divelogs(const bool selected)
|
||||||
{
|
{
|
||||||
|
const QString errPrefix("divelog.de-upload:");
|
||||||
|
if (!amount_selected) {
|
||||||
|
qDebug() << errPrefix << "no dives selected";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
struct dive *dive;
|
struct dive *dive;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
@ -111,7 +117,6 @@ static char *prepare_dives_for_divelogs(const bool selected)
|
||||||
xmlDoc *transformed;
|
xmlDoc *transformed;
|
||||||
struct zip_source *s[dive_table.nr];
|
struct zip_source *s[dive_table.nr];
|
||||||
struct zip *zip;
|
struct zip *zip;
|
||||||
const QString errPrefix("divelog.de-upload:");
|
|
||||||
|
|
||||||
/* generate a random filename and create/open that file with zip_open */
|
/* generate a random filename and create/open that file with zip_open */
|
||||||
QString tempfileQ = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld";
|
QString tempfileQ = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld";
|
||||||
|
@ -123,11 +128,6 @@ static char *prepare_dives_for_divelogs(const bool selected)
|
||||||
free((void *)tempfile);
|
free((void *)tempfile);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!amount_selected) {
|
|
||||||
qDebug() << errPrefix << "no dives selected";
|
|
||||||
free((void *)tempfile);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* walk the dive list in chronological order */
|
/* walk the dive list in chronological order */
|
||||||
for (i = 0; i < dive_table.nr; i++) {
|
for (i = 0; i < dive_table.nr; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue