summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-09-29 14:51:04 (GMT)
committerStefan Kost <ensonic@users.sf.net>2009-09-30 06:19:48 (GMT)
commitb1feeee166b316689f1a3020d7ef37146fbf2ef1 (patch)
treefb6bee46c546cf79c5ad367f18f22b49bb6abc8f
parent477cb58640f1bd07317f1b54148338b75cb2b1fa (diff)
jpegdec: don't leak output buffers on decoding errors
The setjmp handles libjpeg error. Free the outputbffer if we don't need it.
-rw-r--r--ext/jpeg/gstjpegdec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index bb3961d..1d2d4dd 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -850,7 +850,7 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
{
GstFlowReturn ret = GST_FLOW_OK;
GstJpegDec *dec;
- GstBuffer *outbuf;
+ GstBuffer *outbuf = NULL;
guchar *data, *outdata;
guchar *base[3], *last[3];
guint img_len, outsize;
@@ -1143,6 +1143,10 @@ exit:
need_more_data:
{
GST_LOG_OBJECT (dec, "we need more data");
+ if (outbuf) {
+ gst_buffer_unref (outbuf);
+ outbuf = NULL;
+ }
ret = GST_FLOW_OK;
goto exit;
}
@@ -1160,6 +1164,10 @@ decode_error:
GST_ELEMENT_ERROR (dec, STREAM, DECODE,
(_("Failed to decode JPEG image")),
("Error #%u: %s", code, dec->jerr.pub.jpeg_message_table[code]));
+ if (outbuf) {
+ gst_buffer_unref (outbuf);
+ outbuf = NULL;
+ }
ret = GST_FLOW_ERROR;
goto done;
}