diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-10-01 21:10:11 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-01 21:12:31 -0400 |
commit | 15a55b9648564eded8e40347185b8186e11220d8 (patch) | |
tree | 7f5687c20fbbf3e3ce9902b447a67e2c5f73a037 | |
parent | 7d8a36820d9db03956191cfe8f10087d93bf17b5 (diff) | |
download | subsurface-15a55b9648564eded8e40347185b8186e11220d8.tar.gz |
Avoid resource leak
Coverity CID 1307997
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | datatrak.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/datatrak.h b/datatrak.h index 4e3ccd1a4..3e01c4e76 100644 --- a/datatrak.h +++ b/datatrak.h @@ -27,8 +27,9 @@ typedef struct dtrakheader_ { } #define read_string(_property) \ - _property = (unsigned char *)calloc(tmp_1byte + 1, 1); \ - fread((char *)_property, 1, tmp_1byte, archivo); \ - _property = (unsigned char *)strcat(to_utf8(_property), ""); + unsigned char *_property##tmp = (unsigned char *)calloc(tmp_1byte + 1, 1); \ + fread((char *)_property##tmp, 1, tmp_1byte, archivo); \ + _property = (unsigned char *)strcat(to_utf8(_property##tmp), ""); \ + free(_property##tmp); #endif // DATATRAK_HEADER_H |