gst/base/gstbasetransform.c: Fix a pretty good memleak.

Original commit message from CVS:
* gst/base/gstbasetransform.c: (gst_base_transform_buffer_alloc):
Fix a pretty good memleak.
This commit is contained in:
Ronald S. Bultje 2005-08-08 15:08:14 +00:00
parent 4f74a712c4
commit d32de37076
3 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2005-08-08 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/base/gstbasetransform.c: (gst_base_transform_buffer_alloc):
Fix a pretty good memleak.
2005-08-08 Tim-Philipp Müller <tim at centricular dot net> 2005-08-08 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstiterator.h: * gst/gstiterator.h:

View file

@ -535,6 +535,9 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
goto unknown_size; goto unknown_size;
} }
if (*buf) {
gst_buffer_unref (*buf);
}
*buf = gst_buffer_new_and_alloc (got_size); *buf = gst_buffer_new_and_alloc (got_size);
gst_buffer_set_caps (*buf, sinkcaps); gst_buffer_set_caps (*buf, sinkcaps);
GST_BUFFER_OFFSET (*buf) = offset; GST_BUFFER_OFFSET (*buf) = offset;
@ -549,14 +552,20 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
not_configured: not_configured:
{ {
/* let the default allocator handle it */ /* let the default allocator handle it */
*buf = NULL; if (*buf) {
gst_buffer_unref (*buf);
*buf = NULL;
}
gst_object_unref (trans); gst_object_unref (trans);
return GST_FLOW_OK; return GST_FLOW_OK;
} }
unknown_size: unknown_size:
{ {
/* let the default allocator handle it */ /* let the default allocator handle it */
*buf = NULL; if (*buf) {
gst_buffer_unref (*buf);
*buf = NULL;
}
gst_object_unref (trans); gst_object_unref (trans);
return GST_FLOW_OK; return GST_FLOW_OK;
} }

View file

@ -535,6 +535,9 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
goto unknown_size; goto unknown_size;
} }
if (*buf) {
gst_buffer_unref (*buf);
}
*buf = gst_buffer_new_and_alloc (got_size); *buf = gst_buffer_new_and_alloc (got_size);
gst_buffer_set_caps (*buf, sinkcaps); gst_buffer_set_caps (*buf, sinkcaps);
GST_BUFFER_OFFSET (*buf) = offset; GST_BUFFER_OFFSET (*buf) = offset;
@ -549,14 +552,20 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
not_configured: not_configured:
{ {
/* let the default allocator handle it */ /* let the default allocator handle it */
*buf = NULL; if (*buf) {
gst_buffer_unref (*buf);
*buf = NULL;
}
gst_object_unref (trans); gst_object_unref (trans);
return GST_FLOW_OK; return GST_FLOW_OK;
} }
unknown_size: unknown_size:
{ {
/* let the default allocator handle it */ /* let the default allocator handle it */
*buf = NULL; if (*buf) {
gst_buffer_unref (*buf);
*buf = NULL;
}
gst_object_unref (trans); gst_object_unref (trans);
return GST_FLOW_OK; return GST_FLOW_OK;
} }