From e3222225134b9af7c36c4dc20bb2266c979a77d9 Mon Sep 17 00:00:00 2001 From: short <> Date: Wed, 10 Dec 2003 20:53:54 +0000 Subject: [PATCH] Fixed some minor 'GnomeVFSFileInfo' disk scanning memory leaks. - Bugreport by Steve Wampler. --- src/install/acquire/moduriload.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/install/acquire/moduriload.c b/src/install/acquire/moduriload.c index 6c4f8d0..94202f4 100644 --- a/src/install/acquire/moduriload.c +++ b/src/install/acquire/moduriload.c @@ -216,19 +216,20 @@ GnomeVFSHandle *handle; if (GNOME_VFS_OK!=(errvfsresult=gnome_vfs_open_uri(&handle,uri,GNOME_VFS_OPEN_READ))) goto fail; + CAPTIVE_MEMZERO(&file_info_local); if (GNOME_VFS_OK!=(errvfsresult=gnome_vfs_get_file_info_from_handle(handle,&file_info_local,GNOME_VFS_FILE_INFO_DEFAULT))) goto fail_close_handle; if (file_info_local.type!=GNOME_VFS_FILE_TYPE_REGULAR) { errvfsresult=GNOME_VFS_ERROR_WRONG_FORMAT; - goto fail_close_handle; + goto fail_file_info_local_clear; } if (!(file_info_local.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE)) { errvfsresult=GNOME_VFS_ERROR_WRONG_FORMAT; - goto fail_close_handle; + goto fail_file_info_local_clear; } if (!captivemodid_module_length_is_valid(file_info_local.size)) { errvfsresult=GNOME_VFS_ERROR_WRONG_FORMAT; - goto fail_close_handle; + goto fail_file_info_local_clear; } if (file_info_local.size<=MAX_FILE_LOAD_LENGTH) mod_uri_load_file_handle_to_memory(handle,&file_info_local,uri); @@ -239,6 +240,8 @@ gint cabinet_used=captivemodid_cabinet_length_to_used(file_info_local.size); } errvfsresult=GNOME_VFS_OK; /* PASSTHRU */ +fail_file_info_local_clear: + gnome_vfs_file_info_clear(&file_info_local); fail_close_handle: gnome_vfs_close(handle); fail:; @@ -332,6 +335,7 @@ gchar *uri_text; g_free(uri_text); } + CAPTIVE_MEMZERO(&file_info_local); file_info_local.type=GNOME_VFS_FILE_TYPE_UNKNOWN; if (GNOME_VFS_OK!=(errvfsresult=gnome_vfs_get_file_info_uri(uri,&file_info_local,GNOME_VFS_FILE_INFO_DEFAULT))) { if (base_reporting) { @@ -344,11 +348,11 @@ gchar *uri_text; return; } switch (file_info_local.type) { - case GNOME_VFS_FILE_TYPE_REGULAR: return mod_uri_load_file(uri); - case GNOME_VFS_FILE_TYPE_DIRECTORY: return mod_uri_load_directory(uri); - default: return /* GNOME_VFS_ERROR_WRONG_FORMAT */; + case GNOME_VFS_FILE_TYPE_REGULAR: mod_uri_load_file(uri); + case GNOME_VFS_FILE_TYPE_DIRECTORY: mod_uri_load_directory(uri); + default: /* GNOME_VFS_ERROR_WRONG_FORMAT */; } - /* NOTREACHED */ + gnome_vfs_file_info_clear(&file_info_local); } void mod_uri_load(GnomeVFSURI *uri) -- 1.8.3.1