[vlc-devel] [PATCH] bluray: fix memory leak

Edward Wang edward.c.wang at compdigitec.com
Sun Jun 3 17:29:04 CEST 2012


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

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 254001f..af190d8 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);
         }
     }
-- 
1.7.5.4




More information about the vlc-devel mailing list