summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-01 21:10:11 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-01 21:12:31 -0400
commit15a55b9648564eded8e40347185b8186e11220d8 (patch)
tree7f5687c20fbbf3e3ce9902b447a67e2c5f73a037
parent7d8a36820d9db03956191cfe8f10087d93bf17b5 (diff)
downloadsubsurface-15a55b9648564eded8e40347185b8186e11220d8.tar.gz
Avoid resource leak
Coverity CID 1307997 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--datatrak.h7
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