From 22b5ace2ab4422f627209561e8ecafdb0bebb291 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sun, 22 Aug 2010 22:21:41 +0000 Subject: [PATCH] more check cleans (bogus actually too - but you guys like to shut up warnings don't you?) SVN revision: 51544 --- legacy/eet/src/lib/eet_lib.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/legacy/eet/src/lib/eet_lib.c b/legacy/eet/src/lib/eet_lib.c index b736fc045d..3fc2ac2bff 100644 --- a/legacy/eet/src/lib/eet_lib.c +++ b/legacy/eet/src/lib/eet_lib.c @@ -958,9 +958,14 @@ eet_internal_read2(Eet_File *ef) /* out directory block is inconsistent - we have oveerun our */ /* dynamic block buffer before we finished scanning dir entries */ - efn = malloc (sizeof(Eet_File_Node)); + efn = malloc(sizeof(Eet_File_Node)); if (eet_test_close(!efn, ef)) - return NULL; + { + if (efn) free(efn); /* yes i know - we only get here if + * efn is null/0 -> trying to shut up + * warning tools like cppcheck */ + return NULL; + } /* get entrie header */ GET_INT(efn->offset, data, idx); @@ -1220,7 +1225,12 @@ eet_internal_read1(Eet_File *ef) /* allocate all the ram needed for this stored node accounting */ efn = malloc (sizeof(Eet_File_Node)); if (eet_test_close(!efn, ef)) - return NULL; + { + if (efn) free(efn); /* yes i know - we only get here if + * efn is null/0 -> trying to shut up + * warning tools like cppcheck */ + return NULL; + } /* get entrie header */ EXTRACT_INT(efn->offset, p, indexn);