From 3cdb7df50b7a06929236df30bff7f8f8b1453ea4 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 12 Mar 2019 10:07:26 -0400 Subject: [PATCH] efl_core_command_line: Fix dereference before NULL check This patch fixes an issue detected by Coverity where pd->string_command is dereferenced before a NULL check. Fixes Coverity CID1399098 Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8311 --- src/lib/ecore/efl_core_command_line.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_core_command_line.c b/src/lib/ecore/efl_core_command_line.c index c51e64a98d..1c084030f1 100644 --- a/src/lib/ecore/efl_core_command_line.c +++ b/src/lib/ecore/efl_core_command_line.c @@ -257,7 +257,9 @@ _efl_core_command_line_command_string_set(Eo *obj EINA_UNUSED, Efl_Core_Command_ EINA_SAFETY_ON_TRUE_RETURN_VAL(pd->filled, EINA_FALSE); pd->string_command = eina_strdup(str); - _remove_invalid_chars(pd->string_command); + + if (pd->string_command) + _remove_invalid_chars(pd->string_command); pd->command = _unescape(str); if (!pd->command) {