decoder: fix unpaired GstBuffer map/unmaps.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 20 Mar 2013 10:26:38 +0000 (11:26 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 10 Apr 2013 12:58:17 +0000 (14:58 +0200)
This possibly fixes a few memory leaks along the way.

gst-libs/gst/vaapi/gstvaapidecoder.c
gst-libs/gst/vaapi/gstvaapidecoder_h264.c
gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c
gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c
gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c
gst-libs/gst/vaapi/gstvaapidecoder_vc1.c

index 77fe119..3225b9f 100644 (file)
@@ -972,5 +972,6 @@ gst_vaapi_decoder_decode_codec_data(GstVaapiDecoder *decoder)
         status = klass->decode_codec_data(decoder, buf, buf_size);
     else
         status = GST_VAAPI_DECODER_STATUS_SUCCESS;
+    gst_buffer_unmap(codec_data, &map_info);
     return status;
 }
index 6b69082..aa61aeb 100644 (file)
@@ -2716,6 +2716,7 @@ decode_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnit *unit)
 
     slice = GST_VAAPI_SLICE_NEW(H264, decoder,
         (map_info.data + unit->offset + pi->nalu.offset), pi->nalu.size);
+    gst_buffer_unmap(buffer, &map_info);
     if (!slice) {
         GST_ERROR("failed to allocate slice");
         return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
index ba77436..bb50e22 100644 (file)
@@ -692,6 +692,7 @@ gst_vaapi_decoder_jpeg_decode(GstVaapiDecoder *base_decoder,
     }
 
     status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
+    gst_buffer_unmap(buffer, &map_info);
     if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
         return status;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;
index 5c857e1..b320248 100644 (file)
@@ -1211,6 +1211,7 @@ decode_slice(GstVaapiDecoderMpeg2 *decoder, GstVaapiDecoderUnit *unit)
 
     slice = GST_VAAPI_SLICE_NEW(MPEG2, decoder,
         (map_info.data + unit->offset), unit->size);
+    gst_buffer_unmap(buffer, &map_info);
     if (!slice) {
         GST_ERROR("failed to allocate slice");
         return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
@@ -1499,6 +1500,7 @@ gst_vaapi_decoder_mpeg2_decode(GstVaapiDecoder *base_decoder,
     packet.offset = 4;
 
     status = parse_unit(decoder, unit, &packet);
+    gst_buffer_unmap(buffer, &map_info);
     if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
         return status;
     return decode_unit(decoder, unit, &packet);
index d2a0b36..b7b6e0b 100644 (file)
@@ -1097,6 +1097,7 @@ gst_vaapi_decoder_mpeg4_decode(GstVaapiDecoder *base_decoder,
     }
 
     status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
+    gst_buffer_unmap(buffer, &map_info);
     if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
         return status;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;
index e063cd2..6eb701b 100644 (file)
@@ -1267,6 +1267,7 @@ gst_vaapi_decoder_vc1_decode(GstVaapiDecoder *base_decoder,
     }
 
     status = decode_buffer(decoder, map_info.data + unit->offset, unit->size);
+    gst_buffer_unmap(buffer, &map_info);
     if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
         return status;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;