On Mon, 29 Oct 2012 12:56:12 -0200 Leandro Dorileo <dori...@profusion.mobi> wrote:
> Hi, > > On Mon, Oct 29, 2012 at 03:39:29PM +0400, Igor Murzov wrote: > > One more patch to fix issues discovered by cppcheck. > > > > > > -- Igor > > > >From 6dd6b7aa419cd797a7b78d38f8e198d7d91bbdf5 Mon Sep 17 00:00:00 2001 > > From: Igor Murzov <e-m...@date.by> > > Date: Mon, 29 Oct 2012 15:20:56 +0400 > > Subject: [PATCH 2/2] Fix potential invalid memory reads. > > > > (Discovered by cppcheck) > > --- > > src/lib/ecore/ecore_exe.c | 4 +++- > > src/lib/ecore_config/ecore_config.c | 8 +++----- > > src/lib/ecore_config/ecore_config_util.c | 2 +- > > 3 files changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c > > index 7cc4b0f..6420a27 100644 > > --- a/src/lib/ecore/ecore_exe.c > > +++ b/src/lib/ecore/ecore_exe.c > > @@ -692,10 +692,12 @@ ecore_exe_pipe_run(const char *exe_cmd, > > Ecore_Exe_Event_Add *e; > > > > e = _ecore_exe_event_add_new(); > > - e->exe = exe; > > if (e) /* Send the event. */ > > + { > > + e->exe = exe; > > ecore_event_add(ECORE_EXE_EVENT_ADD, e, > > _ecore_exe_event_add_free, NULL); > > + } > > /* INF("Running as %d for %s.\n", exe->pid, exe->cmd); */ > > } > > > > diff --git a/src/lib/ecore_config/ecore_config.c > > b/src/lib/ecore_config/ecore_config.c > > index e81538e..fce9899 100644 > > --- a/src/lib/ecore_config/ecore_config.c > > +++ b/src/lib/ecore_config/ecore_config.c > > @@ -52,12 +52,9 @@ EAPI Ecore_Config_Prop * > > ecore_config_dst(Ecore_Config_Prop * e) > > { > > Ecore_Config_Bundle *t; > > - Ecore_Config_Prop *p, *c; > > Ecore_Config_Listener_List *l; > > > > - p = NULL; > > t = __ecore_config_bundle_local; > > - c = t->data; > > > > if (!e || !e->key) > > return NULL; > > @@ -67,6 +64,8 @@ ecore_config_dst(Ecore_Config_Prop * e) > > t->data = e->next; > > else > > { > > + Ecore_Config_Prop *p, *c; > > > > Why move declaration here? Because p and c are used here -- it's generally clearer and more straightforward to declare variables in the place they are used. But if it breaks current coding conventions, then i can move this line to its initial location. > > + c = t->data; > > do > > { > > p = c; > > @@ -544,8 +543,7 @@ ecore_config_typed_add(const char *key, const void > > *val, int type) > > > > if(e->key) > > free(e->key); > > - if(e) > > - free(e); > > + free(e); > > > > if (error == ECORE_CONFIG_ERR_SUCC) > > error = ECORE_CONFIG_ERR_FAIL; > > diff --git a/src/lib/ecore_config/ecore_config_util.c > > b/src/lib/ecore_config/ecore_config_util.c > > index 6156936..edf126d 100644 > > --- a/src/lib/ecore_config/ecore_config_util.c > > +++ b/src/lib/ecore_config/ecore_config_util.c > > @@ -117,7 +117,7 @@ esprintf(char **result, const char *fmt, ...) > > n[need] = 0; > > > > if(*result) > > - free(result); > > + free(*result); > > *result = n; > > > > return need; > > -- > > 1.7.12.1 > > ------------------------------------------------------------------------------ The Windows 8 Center - In partnership with Sourceforge Your idea - your app - 30 days. Get started! http://windows8center.sourceforge.net/ what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel