[vlc-commits] access: bluray: correct asprintf usage

Francois Cartegnie git at videolan.org
Thu Jun 29 21:16:59 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jun 29 18:56:59 2017 +0200| [da6edd7fe77f128711fd968b19c6a2f5ea5e0ede] | committer: Francois Cartegnie

access: bluray: correct asprintf usage

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

 modules/access/bluray.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 7e4603a3ac..bdd3ffac80 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1921,17 +1921,15 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
         else if (meta->thumb_count > 0 && meta->thumbnails && p_sys->psz_bd_path) {
             char *psz_thumbpath;
             if (asprintf(&psz_thumbpath, "%s" DIR_SEP "BDMV" DIR_SEP "META" DIR_SEP "DL" DIR_SEP "%s",
-                          p_sys->psz_bd_path, meta->thumbnails[0].path) > 0) {
+                          p_sys->psz_bd_path, meta->thumbnails[0].path) > -1) {
                 char *psz_thumburl = vlc_path2uri(psz_thumbpath, "file");
-                if (unlikely(psz_thumburl == NULL)) {
-                    free(psz_thumbpath);
+                free(psz_thumbpath);
+                if (unlikely(psz_thumburl == NULL))
                     return VLC_ENOMEM;
-                }
 
                 vlc_meta_SetArtURL(p_meta, psz_thumburl);
                 free(psz_thumburl);
             }
-            free(psz_thumbpath);
         }
 
         return VLC_SUCCESS;



More information about the vlc-commits mailing list