From 68158437c5ba665780e35ad466147f69366fa934 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Mon, 10 Oct 2005 23:55:39 +0000 Subject: [PATCH] gdp: fix more valgrind warnings before turning up the heat Original commit message from CVS: fix more valgrind warnings before turning up the heat --- gst/gdp/dataprotocol.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gst/gdp/dataprotocol.c b/gst/gdp/dataprotocol.c index 7c39492..804ee16 100644 --- a/gst/gdp/dataprotocol.c +++ b/gst/gdp/dataprotocol.c @@ -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); -- 2.7.4