Close some memory leaks spotted by the unit test. Fixes bug #515697.

Original commit message from CVS:
* gst/multifile/gstmultifilesrc.c: (gst_multi_file_src_create):
* tests/check/elements/multifile.c: (GST_START_TEST):
Close some memory leaks spotted by the unit test. Fixes bug #515697.
This commit is contained in:
Sebastian Dröge 2008-02-11 14:01:52 +00:00
parent b603027de7
commit 0f180098a1
4 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2008-02-11 Sebastian Dröge <slomo@circular-chaos.org>
* gst/multifile/gstmultifilesrc.c: (gst_multi_file_src_create):
* tests/check/elements/multifile.c: (GST_START_TEST):
Close some memory leaks spotted by the unit test. Fixes bug #515697.
2008-02-11 Sebastian Dröge <slomo@circular-chaos.org>
* ext/gconf/gconf.c: (gst_gconf_render_bin_with_default):

2
common

@ -1 +1 @@
Subproject commit 961bb6bd997d7c8da6058534e86b4a1361c0fcea
Subproject commit 05a617c9043ddb78f8578195b18c166d7e1d4c2e

View file

@ -285,6 +285,8 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
/* If we've read at least one buffer successfully, not finding the
* next file is EOS. */
g_free (filename);
if (error != NULL)
g_error_free (error);
return GST_FLOW_UNEXPECTED;
} else {
goto handle_error;
@ -296,6 +298,7 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
buf = gst_buffer_new ();
GST_BUFFER_DATA (buf) = (unsigned char *) data;
GST_BUFFER_MALLOCDATA (buf) = GST_BUFFER_DATA (buf);
GST_BUFFER_SIZE (buf) = size;
GST_BUFFER_OFFSET (buf) = multifilesrc->offset;
GST_BUFFER_OFFSET_END (buf) = multifilesrc->offset + size;
@ -310,12 +313,15 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
handle_error:
{
switch (errno) {
default:{
GST_ELEMENT_ERROR (multifilesrc, RESOURCE, READ,
("Error while reading from file \"%s\".", filename),
("%s", g_strerror (errno)));
}
if (error != NULL) {
GST_ELEMENT_ERROR (multifilesrc, RESOURCE, READ,
("Error while reading from file \"%s\".", filename),
("%s", error->message));
g_error_free (error);
} else {
GST_ELEMENT_ERROR (multifilesrc, RESOURCE, READ,
("Error while reading from file \"%s\".", filename),
("%s", g_strerror (errno)));
}
g_free (filename);
return GST_FLOW_ERROR;

View file

@ -74,6 +74,7 @@ GST_START_TEST (test_multifilesink)
fail_if (mfs == NULL);
mfs_pattern = g_build_filename (my_tmpdir, "%05d", NULL);
g_object_set (G_OBJECT (mfs), "location", mfs_pattern, NULL);
g_object_unref (mfs);
run_pipeline (pipeline);
gst_object_unref (pipeline);
@ -117,6 +118,8 @@ GST_START_TEST (test_multifilesrc)
fail_if (mfs == NULL);
mfs_pattern = g_build_filename (my_tmpdir, "%05d", NULL);
g_object_set (G_OBJECT (mfs), "location", mfs_pattern, NULL);
g_free (mfs_pattern);
g_object_unref (mfs);
run_pipeline (pipeline);
gst_object_unref (pipeline);
@ -129,6 +132,7 @@ GST_START_TEST (test_multifilesrc)
fail_if (mfs == NULL);
mfs_pattern = g_build_filename (my_tmpdir, "%05d", NULL);
g_object_set (G_OBJECT (mfs), "location", mfs_pattern, NULL);
g_object_unref (mfs);
run_pipeline (pipeline);
gst_object_unref (pipeline);