stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f69f34c5382c686b418097a8a972aebce46cdb08

commit f69f34c5382c686b418097a8a972aebce46cdb08
Author: Srivardhan Hebbar <sri.heb...@samsung.com>
Date:   Mon Sep 7 11:13:48 2015 +0200

    ecore_example: Fixing NULL dereference.
    
    Summary:
    cd was dereferenced and then was checked for NULL. If cd is NULL, it would 
crash before itself. So checking for NULL before dereferencing cd.
    
    Signed-off-by: Srivardhan Hebbar <sri.heb...@samsung.com>
    
    Reviewers: cedric, stefan_schmidt
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3009
---
 src/examples/ecore/ecore_buffer_consumer_example.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/examples/ecore/ecore_buffer_consumer_example.c 
b/src/examples/ecore/ecore_buffer_consumer_example.c
index e24a3e2..1363aa0 100644
--- a/src/examples/ecore/ecore_buffer_consumer_example.c
+++ b/src/examples/ecore/ecore_buffer_consumer_example.c
@@ -146,7 +146,7 @@ main(void)
 
    cd = (Consumer_Data *)calloc(sizeof(Consumer_Data), 1);
 
-   if (!(cd->consumer = ecore_buffer_consumer_new(name, queue_size, WIDTH, 
HEIGHT)))
+   if (!cd || !(cd->consumer = ecore_buffer_consumer_new(name, queue_size, 
WIDTH, HEIGHT)))
      {
         LOG("Failed to create consumer");
         goto shutdown;
@@ -185,7 +185,7 @@ shutdown:
    if (cd->win.ee) ecore_evas_free(cd->win.ee);
    if (cd->buffer) ecore_buffer_consumer_buffer_release(cd->consumer, 
cd->buffer);
    if (cd->consumer) ecore_buffer_consumer_free(cd->consumer);
-   if (cd) free(cd);
+   free(cd);
 
    shutdown_all();
    return 0;

-- 


Reply via email to