Commit 0c606747 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

ext/gdk_pixbuf/pixbufscale.c: Don't leak caps string (fixes #168134)

Original commit message from CVS:
* ext/gdk_pixbuf/pixbufscale.c: (gst_pixbufscale_link):
Don't leak caps string (fixes #168134)

* ext/jpeg/gstjpegenc.c: (gst_jpegenc_class_init),
(gst_jpegenc_init), (gst_jpegenc_finalize),
(gst_jpegenc_change_state):
Don't leak line buffers and context struct (fixes #168133).
parent c76c257f
2005-02-22 Luca Ognibene <luogni@tin.it>
Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
* ext/gdk_pixbuf/pixbufscale.c: (gst_pixbufscale_link):
Don't leak caps string (fixes #168134)
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_class_init),
(gst_jpegenc_init), (gst_jpegenc_finalize),
(gst_jpegenc_change_state):
Don't leak line buffers and context struct (fixes #168133).
2005-02-21 Tim-Philipp Müller <tim at centricular dot net>
* configure.ac:
......
......@@ -206,8 +206,12 @@ gst_pixbufscale_link (GstPad * pad, const GstCaps * caps)
GstPad *otherpad;
GstStructure *structure;
int height, width;
gchar *caps_string;
caps_string = gst_caps_to_string (caps);
GST_DEBUG ("gst_pixbufscale_link %s\n", caps_string);
g_free (caps_string);
GST_DEBUG ("gst_pixbufscale_link %s\n", gst_caps_to_string (caps));
pixbufscale = GST_PIXBUFSCALE (gst_pad_get_parent (pad));
otherpad = (pad == pixbufscale->srcpad) ? pixbufscale->sinkpad :
......
......@@ -75,6 +75,7 @@ enum
static void gst_jpegenc_base_init (gpointer g_class);
static void gst_jpegenc_class_init (GstJpegEnc * klass);
static void gst_jpegenc_init (GstJpegEnc * jpegenc);
static void gst_jpegenc_finalize (GObject * object);
static void gst_jpegenc_chain (GstPad * pad, GstData * _data);
static GstPadLinkReturn gst_jpegenc_link (GstPad * pad, const GstCaps * caps);
......@@ -85,6 +86,8 @@ static void gst_jpegenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_jpegenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementStateReturn gst_jpegenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
static guint gst_jpegenc_signals[LAST_SIGNAL] = { 0 };
......@@ -170,6 +173,9 @@ gst_jpegenc_class_init (GstJpegEnc * klass)
gobject_class->set_property = gst_jpegenc_set_property;
gobject_class->get_property = gst_jpegenc_get_property;
gstelement_class->change_state = gst_jpegenc_change_state;
gobject_class->finalize = gst_jpegenc_finalize;
GST_DEBUG_CATEGORY_INIT (jpegenc_debug, "jpegenc", 0,
"JPEG encoding element");
......@@ -223,13 +229,6 @@ gst_jpegenc_init (GstJpegEnc * jpegenc)
jpegenc->cinfo.err = jpeg_std_error (&jpegenc->jerr);
jpeg_create_compress (&jpegenc->cinfo);
GST_DEBUG ("gst_jpegenc_init: setting line buffers");
jpegenc->line[0] = NULL;
jpegenc->line[1] = NULL;
jpegenc->line[2] = NULL;
gst_jpegenc_resync (jpegenc);
jpegenc->jdest.init_destination = gst_jpegenc_init_destination;
jpegenc->jdest.empty_output_buffer = gst_jpegenc_flush_destination;
jpegenc->jdest.term_destination = gst_jpegenc_term_destination;
......@@ -239,6 +238,17 @@ gst_jpegenc_init (GstJpegEnc * jpegenc)
jpegenc->smoothing = 0;
}
static void
gst_jpegenc_finalize (GObject * object)
{
GstJpegEnc *filter = GST_JPEGENC (object);
jpeg_destroy_compress (&filter->cinfo);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstCaps *
gst_jpegenc_getcaps (GstPad * pad)
{
......@@ -492,3 +502,35 @@ gst_jpegenc_get_property (GObject * object, guint prop_id, GValue * value,
break;
}
}
static GstElementStateReturn
gst_jpegenc_change_state (GstElement * element)
{
GstJpegEnc *filter = GST_JPEGENC (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
GST_DEBUG ("gst_jpegenc_change_state: setting line buffers");
filter->line[0] = NULL;
filter->line[1] = NULL;
filter->line[2] = NULL;
gst_jpegenc_resync (filter);
break;
case GST_STATE_READY_TO_NULL:
g_free (filter->line[0]);
g_free (filter->line[1]);
g_free (filter->line[2]);
filter->line[0] = NULL;
filter->line[1] = NULL;
filter->line[2] = NULL;
break;
default:
break;
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment