Commit 7eeb3ca8 authored by Thomas Vander Stichele's avatar Thomas Vander Stichele
Browse files

fix more valgrind warnings before turning up the heat

Original commit message from CVS:
fix more valgrind warnings before turning up the heat
parent 33a77b7a
2005-10-11 Thomas Vander Stichele <thomas at apestaart dot org>
* check/gst-libs/gdp.c: (GST_START_TEST):
* check/gst/gstcaps.c: (GST_START_TEST):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_crc),
(gst_dp_dump_byte_array), (gst_dp_header_from_buffer),
(gst_dp_packet_from_caps):
fix more valgrind warnings before turning up the heat
2005-10-11 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/parse/grammar.y:
......
......@@ -176,6 +176,8 @@ GST_START_TEST (test_caps)
"Created caps do not match original caps");
/* cleanup */
gst_caps_unref (caps);
gst_caps_unref (newcaps);
g_free (header);
g_free (payload);
g_free (string);
......
......@@ -50,6 +50,7 @@ GST_START_TEST (test_buffer)
GST_DEBUG ("caps: %" GST_PTR_FORMAT, c1);
gst_buffer_set_caps (buffer, c1); /* gives away our c1 ref */
gst_buffer_unref (buffer);
}
......@@ -64,6 +65,8 @@ GST_START_TEST (test_double_append)
s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL);
gst_caps_append_structure (c1, s1);
ASSERT_CRITICAL (gst_caps_append_structure (c1, s1));
gst_caps_unref (c1);
}
GST_END_TEST;
......@@ -93,6 +96,7 @@ GST_START_TEST (test_mutability)
gst_caps_set_simple (c1, "rate", G_TYPE_INT, 1, NULL);
fail_unless (gst_structure_get_int (s1, "rate", &ret));
fail_unless (ret == 1);
gst_caps_unref (c1);
}
GST_END_TEST;
......
common @ 3d0040aa
Subproject commit eb0dd118a086dd4aa405d3871131839d81306245
Subproject commit 3d0040aa51e7b10c94707b50417e99edb1f57f08
......@@ -51,7 +51,7 @@ gst_dp_crc (const guint8 * buffer, register guint length)
{
static gboolean initialized = FALSE;
static guint16 crc_table[256];
guint16 crc_register;
guint16 crc_register = CRC_INIT;
unsigned long i, j, k;
if (!initialized) {
......@@ -66,8 +66,6 @@ gst_dp_crc (const guint8 * buffer, register guint length)
initialized = TRUE;
}
crc_register = CRC_INIT; /* always init register */
/* calc CRC */
for (; length--;) {
crc_register = (guint16) ((crc_register << 8) ^
......@@ -83,7 +81,7 @@ gst_dp_dump_byte_array (guint8 * array, guint length)
{
int i;
int n = 8; /* number of bytes per line */
gchar *line = g_malloc (3 * n + 1);
gchar *line = g_malloc0 (3 * n + 1);
GST_LOG ("dumping byte array of length %d", length);
for (i = 0; i < length; ++i) {
......@@ -170,7 +168,7 @@ gst_dp_header_from_buffer (const GstBuffer * buffer, GstDPHeaderFlag flags,
g_return_val_if_fail (header, FALSE);
*length = GST_DP_HEADER_LENGTH;
h = g_malloc (GST_DP_HEADER_LENGTH);
h = g_malloc0 (GST_DP_HEADER_LENGTH);
/* version, flags, type */
h[0] = (guint8) GST_DP_VERSION_MAJOR;
......@@ -244,7 +242,7 @@ gst_dp_packet_from_caps (const GstCaps * caps, GstDPHeaderFlag flags,
g_return_val_if_fail (payload, FALSE);
*length = GST_DP_HEADER_LENGTH;
h = g_malloc (GST_DP_HEADER_LENGTH);
h = g_malloc0 (GST_DP_HEADER_LENGTH);
string = (guchar *) gst_caps_to_string (caps);
......
......@@ -50,6 +50,7 @@ GST_START_TEST (test_buffer)
GST_DEBUG ("caps: %" GST_PTR_FORMAT, c1);
gst_buffer_set_caps (buffer, c1); /* gives away our c1 ref */
gst_buffer_unref (buffer);
}
......@@ -64,6 +65,8 @@ GST_START_TEST (test_double_append)
s1 = gst_structure_from_string ("audio/x-raw-int,rate=44100", NULL);
gst_caps_append_structure (c1, s1);
ASSERT_CRITICAL (gst_caps_append_structure (c1, s1));
gst_caps_unref (c1);
}
GST_END_TEST;
......@@ -93,6 +96,7 @@ GST_START_TEST (test_mutability)
gst_caps_set_simple (c1, "rate", G_TYPE_INT, 1, NULL);
fail_unless (gst_structure_get_int (s1, "rate", &ret));
fail_unless (ret == 1);
gst_caps_unref (c1);
}
GST_END_TEST;
......
......@@ -176,6 +176,8 @@ GST_START_TEST (test_caps)
"Created caps do not match original caps");
/* cleanup */
gst_caps_unref (caps);
gst_caps_unref (newcaps);
g_free (header);
g_free (payload);
g_free (string);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment