diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-11 14:01:52 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-11 14:01:52 +0000 |
commit | 0f180098a193507b3ec936314d3a789c6b60dbbb (patch) | |
tree | a3ae0ed77519e6c7553ea016f4de59a63ed7fe44 | |
parent | b603027de797e7e2b5afaf01afd369db2178ce7f (diff) |
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.
-rw-r--r-- | ChangeLog | 6 | ||||
m--------- | common | 0 | ||||
-rw-r--r-- | gst/multifile/gstmultifilesrc.c | 18 | ||||
-rw-r--r-- | tests/check/elements/multifile.c | 4 |
4 files changed, 22 insertions, 6 deletions
@@ -1,5 +1,11 @@ 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): Use and unset the GError when pipeline creation fails instead of simply leaking it. Fixes bug #515704. diff --git a/common b/common -Subproject 961bb6bd997d7c8da6058534e86b4a1361c0fce +Subproject 05a617c9043ddb78f8578195b18c166d7e1d4c2 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); |