edje cc mo encoding leak - ensure data is freed when setting up encoding

this should fix CID 1306604
This commit is contained in:
Carsten Haitzler 2016-07-08 18:53:11 +09:00
parent 33880a3d7c
commit b1d9cf8d8d
1 changed files with 12 additions and 6 deletions

View File

@ -1656,7 +1656,7 @@ data_write_mo(Eet_File *ef, int *mo_num)
for (i = 0; i < (int)edje_file->mo_dir->mo_entries_count; i++) for (i = 0; i < (int)edje_file->mo_dir->mo_entries_count; i++)
{ {
Mo_Write *mw; Mo_Write *mw, *mw2;
mw = calloc(1, sizeof(Mo_Write)); mw = calloc(1, sizeof(Mo_Write));
if (!mw) continue; if (!mw) continue;
mw->ef = ef; mw->ef = ef;
@ -1677,17 +1677,23 @@ data_write_mo(Eet_File *ef, int *mo_num)
if (ecore_file_exists(po_path)) if (ecore_file_exists(po_path))
{ {
snprintf(buf, sizeof(buf), "msgfmt -o %s %s", mo_path, po_path); snprintf(buf, sizeof(buf), "msgfmt -o %s %s", mo_path, po_path);
mw->mo_path = strdup(mo_path); mw2 = malloc(sizeof(Mo_Write));
mw->exe = ecore_exe_run(buf, mw); if (mw2)
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, {
_exe_del_cb, mw); memcpy(mw2, mw, sizeof(Mo_Write));
mw2->mo_path = strdup(mo_path);
mw2->exe = ecore_exe_run(buf, mw2);
ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
_exe_del_cb, mw2);
}
} }
else else
error_and_abort(mw->ef, "Invalid .po file."); error_and_abort(mw->ef, "Invalid .po file.");
} }
free(mw);
} }
else else
{ {
if (threads) if (threads)
ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw); ecore_thread_run(data_thread_mo, data_thread_mo_end, NULL, mw);
else else