[vlc-commits] Bluray: fix memory leak

Edward Wang git at videolan.org
Sun Jun 3 17:30:58 CEST 2012


vlc | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Jun  3 17:30:17 2012 +0200| [3e7cc6f5762510082bc4e7301ad9a4ed2bb6de77] | committer: Jean-Baptiste Kempf

Bluray: fix memory leak

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3e7cc6f5762510082bc4e7301ad9a4ed2bb6de77
---

 modules/access/bluray.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 254001f..27e1ba9 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -198,12 +198,13 @@ static int blurayOpen( vlc_object_t *object )
              * sure we look up the real device */
             char* bd_device = realpath(bd_path, NULL);
             while ((m = getmntent_r (mtab, &mbuf, buf, sizeof(buf))) != NULL) {
-                if (!strcmp (m->mnt_fsname, bd_device)) {
+                if (!strcmp (m->mnt_fsname, (bd_device == NULL ? bd_path : bd_device))) {
                     strncpy (bd_path, m->mnt_dir, sizeof(bd_path));
                     bd_path[sizeof(bd_path) - 1] = '\0';
                     break;
                 }
             }
+            free(bd_device);
             endmntent (mtab);
         }
     }



More information about the vlc-commits mailing list