tests: plug various caps leaks

This commit is contained in:
Mark Nauwelaerts 2012-03-30 16:56:45 +02:00
parent aaf84a941e
commit 9289476e77
5 changed files with 14 additions and 7 deletions

View file

@ -66,7 +66,7 @@ GST_START_TEST (test_appsrc_non_null_caps)
{
GstElement *src;
GstBuffer *buffer;
GstCaps *caps;
GstCaps *caps, *ccaps;
src = setup_appsrc ();
@ -99,7 +99,9 @@ GST_START_TEST (test_appsrc_non_null_caps)
/* Check the output caps */
fail_unless (g_list_length (buffers) == 4);
fail_unless (gst_caps_is_equal (gst_pad_get_current_caps (mysinkpad), caps));
ccaps = gst_pad_get_current_caps (mysinkpad);
fail_unless (gst_caps_is_equal (ccaps, caps));
gst_caps_unref (ccaps);
ASSERT_SET_STATE (src, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
gst_caps_unref (caps);

View file

@ -460,9 +460,11 @@ verify_convert (const gchar * which, void *in, int inlength,
{
GstStructure *in_s, *out_s;
gint out_chans;
GstCaps *ccaps;
in_s = gst_caps_get_structure (incaps, 0);
out_s = gst_caps_get_structure (gst_pad_get_current_caps (mysinkpad), 0);
ccaps = gst_pad_get_current_caps (mysinkpad);
out_s = gst_caps_get_structure (ccaps, 0);
fail_unless (gst_structure_get_int (out_s, "channels", &out_chans));
/* positions for 1 and 2 channels are implicit if not provided */
@ -472,6 +474,7 @@ verify_convert (const gchar * which, void *in, int inlength,
gst_structure_to_string (in_s), gst_structure_to_string (out_s));
}
}
gst_caps_unref (ccaps);
}
buffers = g_list_remove (buffers, outbuffer);
@ -994,8 +997,7 @@ GST_START_TEST (test_multichannel_conversion)
get_int_mc_caps (11, G_BYTE_ORDER, 16, 16, TRUE, in_layout);
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, NULL);
RUN_CONVERSION ("11 channels to 2", in,
gst_caps_copy (in_caps), out, gst_caps_copy (out_caps));
RUN_CONVERSION ("11 channels to 2", in, in_caps, out, out_caps);
}
{
gint16 in[] = { 0, 0 };
@ -1017,8 +1019,7 @@ GST_START_TEST (test_multichannel_conversion)
GstCaps *out_caps =
get_int_mc_caps (11, G_BYTE_ORDER, 16, 16, TRUE, out_layout);
RUN_CONVERSION ("2 channels to 11", in,
gst_caps_copy (in_caps), out, gst_caps_copy (out_caps));
RUN_CONVERSION ("2 channels to 11", in, in_caps, out, out_caps);
}
}

View file

@ -58,6 +58,7 @@ src_need_data_cb (GstElement * src, guint size, gpointer data)
GST_BUFFER_OFFSET (buf) = 0;
g_signal_emit_by_name (src, "push-buffer", buf, &ret);
gst_buffer_unref (buf);
fail_unless (ret == GST_FLOW_OK);
}

View file

@ -214,6 +214,8 @@ got_buf_cb (GstElement * sink, GstBuffer * new_buf, GstPad * pad,
if (*p_old_sample)
gst_sample_unref (*p_old_sample);
*p_old_sample = gst_sample_new (new_buf, caps, NULL, NULL);
gst_caps_unref (caps);
}
/* tests the positioning of pixels within the various RGB pixel layouts */

View file

@ -80,6 +80,7 @@ buffer_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
}
}
}
gst_caps_unref (pad_caps);
return TRUE;
}