Commit 3e7cc6f5 authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

Bluray: fix memory leak

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 21e4928a
...@@ -198,12 +198,13 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -198,12 +198,13 @@ static int blurayOpen( vlc_object_t *object )
* sure we look up the real device */ * sure we look up the real device */
char* bd_device = realpath(bd_path, NULL); char* bd_device = realpath(bd_path, NULL);
while ((m = getmntent_r (mtab, &mbuf, buf, sizeof(buf))) != 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)); strncpy (bd_path, m->mnt_dir, sizeof(bd_path));
bd_path[sizeof(bd_path) - 1] = '\0'; bd_path[sizeof(bd_path) - 1] = '\0';
break; break;
} }
} }
free(bd_device);
endmntent (mtab); endmntent (mtab);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment