Author: lupus
Date: 2007-08-03 06:56:48 -0400 (Fri, 03 Aug 2007)
New Revision: 83394
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/appdomain.c
trunk/mono/mono/metadata/file-io.c
Log:
Fri Aug 3 13:13:39 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
* file-io.c, appdomain.c: memory leak fixes.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-08-03 10:40:19 UTC (rev 83393)
+++ trunk/mono/mono/metadata/ChangeLog 2007-08-03 10:56:48 UTC (rev 83394)
@@ -1,3 +1,8 @@
+
+Fri Aug 3 13:13:39 CEST 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * file-io.c, appdomain.c: memory leak fixes.
+
2007-08-02 Dick Porter <[EMAIL PROTECTED]>
* socket-io.c
Modified: trunk/mono/mono/metadata/appdomain.c
===================================================================
--- trunk/mono/mono/metadata/appdomain.c 2007-08-03 10:40:19 UTC (rev
83393)
+++ trunk/mono/mono/metadata/appdomain.c 2007-08-03 10:56:48 UTC (rev
83394)
@@ -858,19 +858,20 @@
char name_hash [9];
char path_hash [30];
char *bname = g_path_get_basename (filename);
+ char *dirname = g_path_get_dirname (filename);
+ char *location, *dyn_base;
MonoDomain *domain = mono_domain_get ();
hash = get_cstring_hash (bname);
- hash2 = get_cstring_hash (g_path_get_dirname (filename));
+ hash2 = get_cstring_hash (dirname);
g_snprintf (name_hash, sizeof (name_hash), "%08x", hash);
g_snprintf (path_hash, sizeof (path_hash), "%08x_%08x_%08x", hash ^
hash2, hash2, domain->shadow_serial);
- return g_build_filename (mono_string_to_utf8
(domain->setup->dynamic_base),
- "assembly",
- "shadow",
- name_hash,
- path_hash,
- bname,
- NULL);
+ dyn_base = mono_string_to_utf8 (domain->setup->dynamic_base);
+ location = g_build_filename (dyn_base, "assembly", "shadow", name_hash,
path_hash, bname, NULL);
+ g_free (dyn_base);
+ g_free (bname);
+ g_free (dirname);
+ return location;
}
static gboolean
Modified: trunk/mono/mono/metadata/file-io.c
===================================================================
--- trunk/mono/mono/metadata/file-io.c 2007-08-03 10:40:19 UTC (rev 83393)
+++ trunk/mono/mono/metadata/file-io.c 2007-08-03 10:56:48 UTC (rev 83394)
@@ -301,17 +301,17 @@
if (FindClose (find_handle) == FALSE) {
*error = GetLastError ();
- g_ptr_array_free (names, TRUE);
- g_free (utf8_path);
- return(NULL);
+ result = NULL;
+ } else {
+ result = mono_array_new (domain, mono_defaults.string_class,
names->len);
+ for (i = 0; i < names->len; i++) {
+ mono_array_setref (result, i, mono_string_new (domain,
g_ptr_array_index (names, i)));
+ }
}
- result = mono_array_new (domain, mono_defaults.string_class,
- names->len);
for (i = 0; i < names->len; i++) {
- mono_array_setref (result, i, mono_string_new (domain,
g_ptr_array_index (names, i)));
+ g_free (g_ptr_array_index (names, i));
}
-
g_ptr_array_free (names, TRUE);
g_free (utf8_path);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches