diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-10-06 22:34:11 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-06 22:46:44 +0100 |
commit | 4eb0c77d8578190efbd8fa10ed6665968e1a4379 (patch) | |
tree | 70dfae57ceefa0c59237f94469ba30bebefc28ed /datatrak.h | |
parent | 415d3501da64cfcbe098507749c796513d47ed90 (diff) | |
download | subsurface-4eb0c77d8578190efbd8fa10ed6665968e1a4379.tar.gz |
Avoid leaking memory
Coverity CID 1325756 and others
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'datatrak.h')
-rw-r--r-- | datatrak.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/datatrak.h b/datatrak.h index 1b518ce10..3a37e0465 100644 --- a/datatrak.h +++ b/datatrak.h @@ -31,8 +31,10 @@ typedef struct dtrakheader_ { #define read_string(_property) \ 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; \ + } \ _property = (unsigned char *)strcat(to_utf8(_property##tmp), ""); \ free(_property##tmp); |