Commit 8a2d8148 authored by Edward Hervey's avatar Edward Hervey

gst/avi/gstavidemux.c: Memleak and crasher fixes.

Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_stream), (gst_avi_demux_stream_header),
(gst_avi_demux_invert):
Memleak and crasher fixes.
* gst/wavparse/gstwavparse.c: (gst_wavparse_base_init),
(gst_wavparse_create_sourcepad), (gst_wavparse_stream_headers):
Memleak fixes
parent b6540959
2005-12-07 Edward Hervey <edward@fluendo.com>
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_stream), (gst_avi_demux_stream_header),
(gst_avi_demux_invert):
Memleak and crasher fixes.
* gst/wavparse/gstwavparse.c: (gst_wavparse_base_init),
(gst_wavparse_create_sourcepad), (gst_wavparse_stream_headers):
Memleak fixes
2005-12-06 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/aalib/gstaasink.h:
......
......@@ -468,8 +468,9 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event)
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
&stop_type, &stop);
GST_DEBUG_OBJECT (avi, "seek format %d, %08x, start:%lld, stop:%lld",
format, stream->strh->type, start, stop);
GST_DEBUG_OBJECT (avi,
"seek format %d, flags:%d, %08x, start:%lld, stop:%lld", format,
flags, stream->strh->type, start, stop);
if (format != GST_FORMAT_TIME) {
res &=
......@@ -1045,6 +1046,8 @@ gst_avi_demux_parse_stream (GstElement * element, GstBuffer * buf)
}
/* set proper settings and add it */
if (stream->pad)
gst_object_unref (stream->pad);
pad = stream->pad = gst_pad_new_from_template (templ, padname);
g_free (padname);
......@@ -1848,7 +1851,8 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
GST_FOURCC_ARGS (GST_READ_UINT32_LE (GST_BUFFER_DATA (sub))));
/* fall-through */
case GST_RIFF_TAG_JUNK:
gst_buffer_unref (sub);
if (sub)
gst_buffer_unref (sub);
break;
}
break;
......@@ -1858,7 +1862,8 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
offset, GST_FOURCC_ARGS (tag));
/* fall-through */
case GST_RIFF_TAG_JUNK:
gst_buffer_unref (sub);
if (sub)
gst_buffer_unref (sub);
break;
}
}
......@@ -1908,6 +1913,7 @@ gst_avi_demux_stream_header (GstAviDemux * avi)
if (t) {
gst_element_found_tags (GST_ELEMENT (avi), t);
}
gst_buffer_unref (sub);
gst_buffer_unref (buf);
}
/* gst_riff_read_chunk() has already advanced avi->offset */
......@@ -2068,7 +2074,14 @@ gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf)
{
buf = gst_buffer_make_writable (buf);
gint y, h = stream->strf.vids->height, w = stream->strf.vids->width;
guint8 *tmp = g_malloc (w);
guint8 *tmp = NULL;
if (GST_BUFFER_SIZE (buf) < (w * h)) {
GST_WARNING ("Buffer is smaller than reported Width x Height");
return buf;
}
tmp = g_malloc (w);
for (y = 0; y < h / 2; y++) {
swap_line (GST_BUFFER_DATA (buf) + w * y,
......
......@@ -143,6 +143,7 @@ static void
gst_wavparse_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstPadTemplate *templ;
static GstElementDetails gst_wavparse_details =
GST_ELEMENT_DETAILS (".wav demuxer",
"Codec/Demuxer/Audio",
......@@ -152,10 +153,12 @@ gst_wavparse_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_wavparse_details);
/* register src pads */
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template_factory));
templ = gst_static_pad_template_get (&sink_template_factory);
gst_element_class_add_pad_template (element_class, templ);
gst_object_unref (templ);
templ = gst_static_pad_template_get (&src_template_factory);
gst_element_class_add_pad_template (element_class, templ);
gst_object_unref (templ);
}
static void
......@@ -228,12 +231,14 @@ gst_wavparse_destroy_sourcepad (GstWavParse * wavparse)
static void
gst_wavparse_create_sourcepad (GstWavParse * wavparse)
{
GstPadTemplate *templ;
gst_wavparse_destroy_sourcepad (wavparse);
/* source */
wavparse->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&src_template_factory), "src");
templ = gst_static_pad_template_get (&src_template_factory);
wavparse->srcpad = gst_pad_new_from_template (templ, "src");
gst_object_unref (templ);
gst_pad_use_fixed_caps (wavparse->srcpad);
gst_pad_set_query_type_function (wavparse->srcpad,
GST_DEBUG_FUNCPTR (gst_wavparse_get_query_types));
......@@ -776,6 +781,9 @@ gst_wavparse_stream_headers (GstWavParse * wav)
if (!(gst_riff_parse_strf_auds (GST_ELEMENT (wav), buf, &header, &extra)))
goto parse_header_error;
if (extra)
gst_buffer_unref (extra);
/* Note: gst_riff_create_audio_caps might nedd to fix values in
* the header header depending on the format, so call it first */
caps =
......
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