summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2015-09-07 11:13:48 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2015-09-07 11:13:48 +0200
commitf69f34c5382c686b418097a8a972aebce46cdb08 (patch)
tree621c2b22e782a3673a8629d7fb4ff7910a2b6e9e /src/examples
parent240a275be0d81cd692169bd9b549f8248afb6f13 (diff)
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.hebbar@samsung.com> Reviewers: cedric, stefan_schmidt Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3009
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/ecore/ecore_buffer_consumer_example.c4
1 files 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 e24a3e2ff1..1363aa0282 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)
146 146
147 cd = (Consumer_Data *)calloc(sizeof(Consumer_Data), 1); 147 cd = (Consumer_Data *)calloc(sizeof(Consumer_Data), 1);
148 148
149 if (!(cd->consumer = ecore_buffer_consumer_new(name, queue_size, WIDTH, HEIGHT))) 149 if (!cd || !(cd->consumer = ecore_buffer_consumer_new(name, queue_size, WIDTH, HEIGHT)))
150 { 150 {
151 LOG("Failed to create consumer"); 151 LOG("Failed to create consumer");
152 goto shutdown; 152 goto shutdown;
@@ -185,7 +185,7 @@ shutdown:
185 if (cd->win.ee) ecore_evas_free(cd->win.ee); 185 if (cd->win.ee) ecore_evas_free(cd->win.ee);
186 if (cd->buffer) ecore_buffer_consumer_buffer_release(cd->consumer, cd->buffer); 186 if (cd->buffer) ecore_buffer_consumer_buffer_release(cd->consumer, cd->buffer);
187 if (cd->consumer) ecore_buffer_consumer_free(cd->consumer); 187 if (cd->consumer) ecore_buffer_consumer_free(cd->consumer);
188 if (cd) free(cd); 188 free(cd);
189 189
190 shutdown_all(); 190 shutdown_all();
191 return 0; 191 return 0;