From 0f180098a193507b3ec936314d3a789c6b60dbbb Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Mon, 11 Feb 2008 14:01:52 +0000 Subject: 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. --- ChangeLog | 6 ++++++ common | 2 +- gst/multifile/gstmultifilesrc.c | 18 ++++++++++++------ tests/check/elements/multifile.c | 4 ++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6ca23a9..5944373a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-11 Sebastian Dröge + + * 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 * ext/gconf/gconf.c: (gst_gconf_render_bin_with_default): diff --git a/common b/common index 961bb6bd..05a617c9 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 961bb6bd997d7c8da6058534e86b4a1361c0fcea +Subproject commit 05a617c9043ddb78f8578195b18c166d7e1d4c2e diff --git a/gst/multifile/gstmultifilesrc.c b/gst/multifile/gstmultifilesrc.c index 47cfad36..dfd1520f 100644 --- a/gst/multifile/gstmultifilesrc.c +++ b/gst/multifile/gstmultifilesrc.c @@ -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; diff --git a/tests/check/elements/multifile.c b/tests/check/elements/multifile.c index 9529dfd2..b190851a 100644 --- a/tests/check/elements/multifile.c +++ b/tests/check/elements/multifile.c @@ -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); -- cgit