aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2019-04-23 09:26:13 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-23 21:08:46 +0200
commit22edf6f4b7fbea85cd0c7549338ec17d67326307 (patch)
tree596dae9dbf55af0242caab4e23047324d15a8d90
parentcsharp: Fix test code memory handling (diff)
downloadefl-22edf6f4b7fbea85cd0c7549338ec17d67326307.tar.gz
efl_core_command_line: Fix resource leak
Coverity reports that we leak the return from _escape(command) here, so since we have to free the return from _escape, place it in it's own variable that we can call free() on after we are done with it. Fixes CID1399105 @fix Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D8688
-rw-r--r--src/lib/ecore/efl_core_command_line.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/ecore/efl_core_command_line.c b/src/lib/ecore/efl_core_command_line.c
index 1c084030f1..64de7a9766 100644
--- a/src/lib/ecore/efl_core_command_line.c
+++ b/src/lib/ecore/efl_core_command_line.c
@@ -215,6 +215,7 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
{
char *content = eina_array_data_get(array, i);
char *param = calloc(1, strlen(content) + 1);
+ char *esc;
if (!param)
{
@@ -236,7 +237,9 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
//build the command
if (i != 0)
eina_strbuf_append(command, " ");
- eina_strbuf_append(command, _escape(content));
+ esc = _escape(content);
+ eina_strbuf_append(command, esc);
+ free(esc);
//convert string to stringshare
strcpy(param, content);
_remove_invalid_chars(param);