vdpau/chroma: fix leak on error
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 7 Jun 2014 14:03:07 +0000 (17:03 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 7 Jun 2014 16:10:58 +0000 (19:10 +0300)
modules/hw/vdpau/chroma.c

index fa63676..947bdcd 100644 (file)
@@ -428,7 +428,7 @@ static picture_t *VideoPassthrough(filter_t *filter, picture_t *src)
     if (unlikely(field == NULL))
     {
         msg_Err(filter, "corrupt VDPAU video surface");
-        return NULL;
+        goto error;
     }
 
     vlc_vdp_video_frame_t *psys = field->frame;
@@ -447,7 +447,7 @@ static picture_t *VideoPassthrough(filter_t *filter, picture_t *src)
 
         picture_t *pic = picture_NewFromFormat(&fmt);
         if (unlikely(pic == NULL))
-            return NULL;
+            goto error;
 
         pic = VideoExport(filter, src, pic);
         if (pic == NULL)
@@ -456,6 +456,9 @@ static picture_t *VideoPassthrough(filter_t *filter, picture_t *src)
         src = VideoImport(filter, pic);
     }
     return src;
+error:
+    picture_Release(src);
+    return NULL;
 }
 
 static inline VdpVideoSurface picture_GetVideoSurface(const picture_t *pic)