2009-09-02 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Wed, 2 Sep 2009 18:07:11 +0000 (18:07 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Wed, 2 Sep 2009 18:07:11 +0000 (18:07 -0000)
* mono-dl.c (mono_dl_open): Don't leak module if name is NULL
* mono-md5.c (mono_md5_get_digest_from_file): Close 'fp' even on
success (just like we do for sha1)

svn path=/trunk/mono/; revision=141161

mono/utils/ChangeLog
mono/utils/mono-dl.c
mono/utils/mono-md5.c

index 75af172cf4e0ba732396103b4890f2b2473e732f..d6d4e15161ac082ce660e997940bcb5c37d7c819 100644 (file)
@@ -1,3 +1,9 @@
+2009-09-02  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * mono-dl.c (mono_dl_open): Don't leak module if name is NULL
+       * mono-md5.c (mono_md5_get_digest_from_file): Close 'fp' even on
+       success (just like we do for sha1)
+
 2009-08-21  Mark Probst  <mark.probst@gmail.com>
 
        * mono-hash.c: When creating a hash table, if the keys are managed
index 9c3faa300122594770e5e48bce9dfaa1509257a8..cef47331ea3902afb20dfaedfb57298c9a2931df 100644 (file)
@@ -333,8 +333,10 @@ mono_dl_open (const char *name, int flags, char **error_msg)
                const char *suff;
                const char *ext;
                /* This platform does not support dlopen */
-               if (name == NULL)
+               if (name == NULL) {
+                       free (module);
                        return NULL;
+               }
                
                suff = ".la";
                ext = strrchr (name, '.');
index c4e0438a0310d2e21bc5bea0ec4c0bf2b3dbf073..eca75dd8586ab42110d3b86ec3d564ab61129a3c 100644 (file)
@@ -347,6 +347,8 @@ mono_md5_get_digest_from_file (const gchar *filename, guchar digest[16])
        if (ferror(fp)) {
                fclose(fp);
                return;
+       } else {
+               fclose(fp);
        }
 
        mono_md5_final (&ctx, digest);