eio: fix memory leak when using file associate.
SVN revision: 75854
This commit is contained in:
parent
19af039b30
commit
f82152f150
|
@ -27,3 +27,7 @@
|
|||
|
||||
* Do not free Windows stuff when it is not used. Fix seg fault
|
||||
* Add log debugging macros
|
||||
|
||||
2012-08-30 Cedric Bail
|
||||
|
||||
* Fix memory leak when using file associate API.
|
||||
|
|
|
@ -11,6 +11,7 @@ Fixes:
|
|||
- memory leak when shutting down fallback monitor.
|
||||
- properly shutdown monitor.
|
||||
- Fix segfault when shutting down the Windows monitor.
|
||||
- Fix memory leak when using file_associate.
|
||||
|
||||
Improvements:
|
||||
- Add log debuggong macros
|
||||
|
|
|
@ -454,7 +454,7 @@ _eio_dir_copy_free(Eio_Dir_Copy *copy)
|
|||
{
|
||||
eina_stringshare_del(copy->progress.source);
|
||||
eina_stringshare_del(copy->progress.dest);
|
||||
free(copy);
|
||||
eio_file_free(©->progress.common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -777,8 +777,7 @@ _eio_dir_stat_done(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
|
||||
async->common.done_cb((void*) async->common.data, &async->common);
|
||||
|
||||
eina_stringshare_del(async->directory);
|
||||
free(async);
|
||||
eio_async_free(async);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -788,8 +787,7 @@ _eio_dir_stat_error(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
|
||||
eio_file_error(&async->common);
|
||||
|
||||
eina_stringshare_del(async->directory);
|
||||
free(async);
|
||||
eio_async_free(async);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -429,7 +429,7 @@ _eio_file_copy_free(Eio_File_Progress *copy)
|
|||
{
|
||||
eina_stringshare_del(copy->source);
|
||||
eina_stringshare_del(copy->dest);
|
||||
free(copy);
|
||||
eio_file_free(©->common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -457,7 +457,7 @@ _eio_file_move_free(Eio_File_Move *move)
|
|||
{
|
||||
eina_stringshare_del(move->progress.source);
|
||||
eina_stringshare_del(move->progress.dest);
|
||||
free(move);
|
||||
eio_file_free(&move->progress.common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -702,6 +702,13 @@ eio_file_copy_do(Ecore_Thread *thread, Eio_File_Progress *copy)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
eio_async_free(Eio_File_Ls *async)
|
||||
{
|
||||
eina_stringshare_del(async->directory);
|
||||
eio_file_free(&async->common);
|
||||
}
|
||||
|
||||
void
|
||||
eio_async_end(void *data, Ecore_Thread *thread __UNUSED__)
|
||||
{
|
||||
|
@ -709,8 +716,7 @@ eio_async_end(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
|
||||
async->common.done_cb((void*) async->common.data, &async->common);
|
||||
|
||||
eina_stringshare_del(async->directory);
|
||||
free(async);
|
||||
eio_async_free(async);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -720,8 +726,7 @@ eio_async_error(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
|
||||
eio_file_error(&async->common);
|
||||
|
||||
eina_stringshare_del(async->directory);
|
||||
free(async);
|
||||
eio_async_free(async);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -464,6 +464,9 @@ Eina_Bool eio_long_file_set(Eio_File *common,
|
|||
Ecore_Thread_Cb end_cb,
|
||||
Ecore_Thread_Cb cancel_cb);
|
||||
|
||||
void eio_file_free(Eio_File *common);
|
||||
void eio_async_free(Eio_File_Ls *async);
|
||||
|
||||
void eio_file_container_set(Eio_File *common, void *container);
|
||||
|
||||
void eio_file_error(Eio_File *common);
|
||||
|
|
|
@ -42,7 +42,7 @@ static void
|
|||
_eio_mkdir_free(Eio_File_Mkdir *m)
|
||||
{
|
||||
eina_stringshare_del(m->path);
|
||||
free(m);
|
||||
eio_file_free(&m->common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -78,7 +78,7 @@ static void
|
|||
_eio_unlink_free(Eio_File_Unlink *l)
|
||||
{
|
||||
eina_stringshare_del(l->path);
|
||||
free(l);
|
||||
eio_file_free(&l->common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -169,7 +169,7 @@ static void
|
|||
_eio_stat_free(Eio_File_Stat *s)
|
||||
{
|
||||
eina_stringshare_del(s->path);
|
||||
free(s);
|
||||
eio_file_free(&s->common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -272,7 +272,7 @@ _eio_chown_free(Eio_File_Chown *ch)
|
|||
if (ch->user) eina_stringshare_del(ch->user);
|
||||
if (ch->group) eina_stringshare_del(ch->group);
|
||||
eina_stringshare_del(ch->path);
|
||||
free(ch);
|
||||
eio_file_free(&ch->common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -321,6 +321,16 @@ eio_file_thread_error(Eio_File *common, Ecore_Thread *thread)
|
|||
ecore_thread_cancel(thread);
|
||||
}
|
||||
|
||||
void
|
||||
eio_file_free(Eio_File *common)
|
||||
{
|
||||
if (common->worker.associated)
|
||||
eina_hash_free(common->worker.associated);
|
||||
if (common->main.associated)
|
||||
eina_hash_free(common->main.associated);
|
||||
free(common);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
eio_long_file_set(Eio_File *common,
|
||||
Eio_Done_Cb done_cb,
|
||||
|
@ -372,6 +382,8 @@ eio_file_set(Eio_File *common,
|
|||
common->error = 0;
|
||||
common->thread = NULL;
|
||||
common->container = NULL;
|
||||
common->worker.associated = NULL;
|
||||
common->main.associated = NULL;
|
||||
|
||||
/* Be aware that ecore_thread_run could call cancel_cb if something goes wrong.
|
||||
This means that common would be destroyed if thread == NULL.
|
||||
|
|
|
@ -113,7 +113,7 @@ _eio_file_xattr_free(Eio_File_Xattr *async)
|
|||
if (async->op == EIO_XATTR_DATA) free(async->todo.xdata.xattr_data);
|
||||
if (async->op == EIO_XATTR_STRING) free(async->todo.xstring.xattr_string);
|
||||
}
|
||||
free(async);
|
||||
eio_file_free(&async->common);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue