From 4eb0c77d8578190efbd8fa10ed6665968e1a4379 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 6 Oct 2015 22:34:11 +0100 Subject: Avoid leaking memory Coverity CID 1325756 and others Signed-off-by: Dirk Hohndel --- datatrak.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3-70-g09d2