libcdio-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libcdio-devel] [PATCH 1/2] iso9660: fix memory leaks in iso9660_ifs_rea


From: Pete Batard
Subject: [Libcdio-devel] [PATCH 1/2] iso9660: fix memory leaks in iso9660_ifs_readdir()
Date: Mon, 16 Jan 2012 23:29:24 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0

Hi,

I've started using libcdio on Windows, and I have found a couple of memory leaks in the library. Please find a fix for the first ones, that are localized in iso9660.

Regards,

/Pete
>From cfe51293a1450202a0617e76a9120a6cb8b9a821 Mon Sep 17 00:00:00 2001
From: Pete Batard <address@hidden>
Date: Mon, 16 Jan 2012 20:02:15 +0000
Subject: [PATCH] iso9660: fix memory leaks in iso9660_ifs_readdir()

---
 lib/iso9660/iso9660_fs.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/iso9660/iso9660_fs.c b/lib/iso9660/iso9660_fs.c
index 9533fcf..e918110 100644
--- a/lib/iso9660/iso9660_fs.c
+++ b/lib/iso9660/iso9660_fs.c
@@ -1390,7 +1390,11 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char 
psz_path[])
       }
 
     ret = iso9660_iso_seek_read (p_iso, _dirbuf, p_stat->lsn, p_stat->secsize);
-    if (ret != ISO_BLOCKSIZE*p_stat->secsize) return NULL;
+    if (ret != ISO_BLOCKSIZE*p_stat->secsize) 
+         {
+           free (_dirbuf);
+           return NULL;
+         }
     
     while (offset < (p_stat->secsize * ISO_BLOCKSIZE))
       {
@@ -1420,6 +1424,7 @@ iso9660_ifs_readdir (iso9660_t *p_iso, const char 
psz_path[])
       return NULL;
     }
 
+    free (p_stat->rr.psz_symlink);
     free (p_stat);
     return retval;
   }
-- 
1.7.8.msysgit.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]