devilhorns pushed a commit to branch master.

commit e28f298dbd42cf08c843f4bbcf4bf1fb1fdad884
Author: Chris Michael <[email protected]>
Date:   Mon Jul 8 11:34:58 2013 +0100

    Fix memleak reported by Coverity: If we error out because we have a
    hash with no key, then free the previously allocated data_stream.
    
    NB: Fixes Coverity CID1039262
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/eet/eet_data.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/lib/eet/eet_data.c b/src/lib/eet/eet_data.c
index 98671e0..4e8a82b 100644
--- a/src/lib/eet/eet_data.c
+++ b/src/lib/eet/eet_data.c
@@ -2891,8 +2891,15 @@ _eet_data_dump_encode(int             parent_type,
                              node->type);
           }
         else
-          /* A Hash without key will not decode correctly. */
-          return NULL;
+          {
+             /* A Hash without key will not decode correctly. */
+
+             ds->data = NULL;
+             ds->size = 0;
+             eet_data_stream_free(ds);
+
+             return NULL;
+          }
 
         for (n = node->values; n; n = n->next)
           {

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to