mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Avoid leaking memory
Coverity CID 1325756 and others Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
415d3501da
commit
4eb0c77d85
1 changed files with 3 additions and 1 deletions
|
@ -31,8 +31,10 @@ typedef struct dtrakheader_ {
|
||||||
|
|
||||||
#define read_string(_property) \
|
#define read_string(_property) \
|
||||||
unsigned char *_property##tmp = (unsigned char *)calloc(tmp_1byte + 1, 1); \
|
unsigned char *_property##tmp = (unsigned char *)calloc(tmp_1byte + 1, 1); \
|
||||||
if (fread((char *)_property##tmp, 1, tmp_1byte, archivo) != tmp_1byte) \
|
if (fread((char *)_property##tmp, 1, tmp_1byte, archivo) != tmp_1byte) { \
|
||||||
|
free(_property##tmp); \
|
||||||
goto bail; \
|
goto bail; \
|
||||||
|
} \
|
||||||
_property = (unsigned char *)strcat(to_utf8(_property##tmp), ""); \
|
_property = (unsigned char *)strcat(to_utf8(_property##tmp), ""); \
|
||||||
free(_property##tmp);
|
free(_property##tmp);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue