mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 03:46:11 +00:00
jpegdec: don't leak output buffers on decoding errors
The setjmp handles libjpeg error. Free the outputbffer if we don't need it.
This commit is contained in:
parent
477cb58640
commit
b1feeee166
1 changed files with 9 additions and 1 deletions
|
@ -850,7 +850,7 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstJpegDec *dec;
|
GstJpegDec *dec;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf = NULL;
|
||||||
guchar *data, *outdata;
|
guchar *data, *outdata;
|
||||||
guchar *base[3], *last[3];
|
guchar *base[3], *last[3];
|
||||||
guint img_len, outsize;
|
guint img_len, outsize;
|
||||||
|
@ -1143,6 +1143,10 @@ exit:
|
||||||
need_more_data:
|
need_more_data:
|
||||||
{
|
{
|
||||||
GST_LOG_OBJECT (dec, "we need more data");
|
GST_LOG_OBJECT (dec, "we need more data");
|
||||||
|
if (outbuf) {
|
||||||
|
gst_buffer_unref (outbuf);
|
||||||
|
outbuf = NULL;
|
||||||
|
}
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -1160,6 +1164,10 @@ decode_error:
|
||||||
GST_ELEMENT_ERROR (dec, STREAM, DECODE,
|
GST_ELEMENT_ERROR (dec, STREAM, DECODE,
|
||||||
(_("Failed to decode JPEG image")),
|
(_("Failed to decode JPEG image")),
|
||||||
("Error #%u: %s", code, dec->jerr.pub.jpeg_message_table[code]));
|
("Error #%u: %s", code, dec->jerr.pub.jpeg_message_table[code]));
|
||||||
|
if (outbuf) {
|
||||||
|
gst_buffer_unref (outbuf);
|
||||||
|
outbuf = NULL;
|
||||||
|
}
|
||||||
ret = GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue