Cleanup: avoid memory leak

The JUMP macro includes a 'goto bail', so we need to free devdata there

Coverity CID 208340

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-26 13:49:49 -08:00
parent 2c8614e43e
commit efb2640fc7

View file

@ -538,7 +538,6 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive)
} else {
report_error(translate("gettextFromC", "[Error] Out of memory for dive %d. Abort parsing."), dt_dive->number);
free(compl_buffer);
free(devdata);
goto bail;
}
if (is_nitrox)
@ -566,6 +565,7 @@ unsigned char *dt_dive_parser(unsigned char *runner, struct dive *dt_dive)
free(devdata);
return membuf;
bail:
free(devdata);
return NULL;
}
/*