From: Sebastian Dransfeld Date: Mon, 19 Apr 2010 08:17:19 +0000 (+0000) Subject: e: fix #528 X-Git-Tag: submit/efl/20131021.015651~7763 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52bb692ae859bf608b874cb1f7ca79d3dba17a78;p=platform%2Fupstream%2Fenlightenment.git e: fix #528 basename may modify its argument, so we need to strdup before calling basename. SVN revision: 48128 --- diff --git a/src/bin/e_exehist.c b/src/bin/e_exehist.c index 4e4b761..fbd8df3 100644 --- a/src/bin/e_exehist.c +++ b/src/bin/e_exehist.c @@ -434,14 +434,18 @@ _e_exehist_limit(void) static const char * _e_exehist_normalize_exe(const char *exe) { - char *base, *cp, *space = NULL; + char *base, *buf, *cp, *space = NULL; const char *ret; Eina_Bool flag = EINA_FALSE; - base = basename((char *)exe); - if ((base[0] == '.') && (base[1] == '\0')) return NULL; + buf = strdup(exe); + base = basename(buf); + if ((base[0] == '.') && (base[1] == '\0')) + { + free(buf); + return NULL; + } - base = strdup(base); cp = base; while (*cp) { @@ -469,7 +473,7 @@ _e_exehist_normalize_exe(const char *exe) if (space) *space = '\0'; ret = eina_stringshare_add(base); - free(base); + free(buf); return ret; }