libs: encoder: h264fei: fix surface leak
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 17 Dec 2019 12:22:12 +0000 (13:22 +0100)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 17 Dec 2019 16:57:09 +0000 (17:57 +0100)
Issue detected by Coverity

If the FEI mode is not handled the created resources should be
released and return and error code.

The system resource will not be reclaimed and reused, reducing the
future availability of the resource.

In gst_vaapi_encoder_h264_fei_encode: Leak of memory or pointers to
system resources

gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c

index ea5c495261ce63e545e32fd21fa41efa6e9fca7e..f5d74a6e10a8dca5a675afef1cef423cbd7e652b 100644 (file)
@@ -2827,7 +2827,9 @@ gst_vaapi_encoder_h264_fei_encode (GstVaapiEncoder * base_encoder,
       g_array_free (info_to_pak.h264_slice_headers, TRUE);
 
     gst_vaapi_enc_picture_unref (picture2);
-
+  } else {
+    GST_ERROR ("invalid FEI mode");
+    goto error;
   }
 
   return GST_VAAPI_ENCODER_STATUS_SUCCESS;