efl_core_command_line: Fix dereference before null check

Coverity reports a dereference before NULL check here. In the for
loop, we are NULL checking 'array', however it has already been
dereferenced before the 'for' loop in eina_array_new above. This patch
fixes the issue by NULL checking 'array' before we ever try to use it.

Fixes Coverity CID1399083

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8307
This commit is contained in:
Christopher Michael 2019-03-12 09:45:18 -04:00 committed by Marcel Hollerbach
parent c6e0a8cbc6
commit 2cef513694
1 changed files with 1 additions and 1 deletions

View File

@ -210,7 +210,7 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
Eina_Strbuf *command = eina_strbuf_new();
unsigned int i = 0;
pd->command = eina_array_new(eina_array_count(array));
pd->command = eina_array_new(array ? eina_array_count(array) : 0);
for (i = 0; i < (array ? eina_array_count(array) : 0); ++i)
{
char *content = eina_array_data_get(array, i);