ecore_example: Fixing NULL deference.

Summary:
pd was dereferenced and then checked for NULL. If it was NULL, the program would crash much before. So fixed that.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: cedric, stefan_schmidt

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D3031
This commit is contained in:
Srivardhan Hebbar 2015-09-07 13:30:48 +02:00 committed by Stefan Schmidt
parent 36a7f59c80
commit 8788cf72a3
1 changed files with 2 additions and 2 deletions

View File

@ -246,7 +246,7 @@ main(void)
pd = (Provider_Data *)calloc(sizeof(Provider_Data), 1);
if (!(pd->provider = ecore_buffer_provider_new(name)))
if (!pd || !(pd->provider = ecore_buffer_provider_new(name)))
{
LOG("Failed to create provider");
goto shutdown;
@ -267,7 +267,7 @@ shutdown:
ecore_buffer_free(b);
}
if (pd->provider) ecore_buffer_provider_free(pd->provider);
if (pd) free(pd);
free(pd);
shutdown_all();
return 0;