Fixed memory leak in vfs_free_handle().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
407d1f38f5
Коммит
f547d149ba
@ -178,13 +178,16 @@ vfs_info (int handle)
|
|||||||
static void
|
static void
|
||||||
vfs_free_handle (int handle)
|
vfs_free_handle (int handle)
|
||||||
{
|
{
|
||||||
if (handle < VFS_FIRST_HANDLE ||
|
const int idx = handle - VFS_FIRST_HANDLE;
|
||||||
(guint)(handle - VFS_FIRST_HANDLE) >= vfs_openfiles->len)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_ptr_array_index (vfs_openfiles, handle - VFS_FIRST_HANDLE) =
|
if (handle >= VFS_FIRST_HANDLE && (guint) idx < vfs_openfiles->len) {
|
||||||
(void *) vfs_free_handle_list;
|
struct vfs_openfile *h;
|
||||||
vfs_free_handle_list = handle - VFS_FIRST_HANDLE;
|
|
||||||
|
h = (struct vfs_openfile *) g_ptr_array_index (vfs_openfiles, idx);
|
||||||
|
g_free (h);
|
||||||
|
g_ptr_array_index (vfs_openfiles, idx) = (void *) vfs_free_handle_list;
|
||||||
|
vfs_free_handle_list = idx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct vfs_class *vfs_list;
|
static struct vfs_class *vfs_list;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user