elementary/fileselector

Hi,

On behalf of Rajeev Ranjan, I am submitting the elc_fileselector patch.

Change Log:
Fix for the memory leak in function elm_fileselector_selected_get. Memory allocated by ecore_file_dir_get() internally using strdup was not freed.
Introduced a char *dir variable to store the memory returned by ecore_file_dir_get() function and releasing the memory before returning to caller.

Please review it.
I'd appreciate any comments on this.

Thank you,
Prince

Signed-Off-By: Rajeev Ranjan (rajeev.r@samsung.com)
Signed-Off-By: Prince Kumar Dubey (prince.dubey@samsung.com)
Signed-Off-By: ChunEon Park (hermet@hermetpe.kr)



SVN revision: 65950
This commit is contained in:
ChunEon Park 2011-12-06 08:18:14 +00:00
parent eb8d16dfb4
commit 17baa1f76b
1 changed files with 4 additions and 2 deletions

View File

@ -1138,12 +1138,14 @@ elm_fileselector_selected_get(const Evas_Object *obj)
{
const char *name;
char buf[PATH_MAX];
char *dir;
dir = wd->only_folder ? ecore_file_dir_get(wd->path) : strdup(wd->path);
name = elm_entry_entry_get(wd->filename_entry);
snprintf(buf, sizeof(buf), "%s/%s",
wd->only_folder ? ecore_file_dir_get(wd->path) : wd->path,
name);
dir, name);
eina_stringshare_replace(&wd->selection, buf);
if (dir) free(dir);
return wd->selection;
}