gdp: fix more valgrind warnings before turning up the heat

Original commit message from CVS:
fix more valgrind warnings before turning up the heat
This commit is contained in:
Thomas Vander Stichele 2005-10-10 23:55:39 +00:00 committed by Tim-Philipp Müller
parent 3e29c4db5c
commit 4447f427d7

View file

@ -51,7 +51,7 @@ gst_dp_crc (const guint8 * buffer, register guint length)
{ {
static gboolean initialized = FALSE; static gboolean initialized = FALSE;
static guint16 crc_table[256]; static guint16 crc_table[256];
guint16 crc_register; guint16 crc_register = CRC_INIT;
unsigned long i, j, k; unsigned long i, j, k;
if (!initialized) { if (!initialized) {
@ -66,8 +66,6 @@ gst_dp_crc (const guint8 * buffer, register guint length)
initialized = TRUE; initialized = TRUE;
} }
crc_register = CRC_INIT; /* always init register */
/* calc CRC */ /* calc CRC */
for (; length--;) { for (; length--;) {
crc_register = (guint16) ((crc_register << 8) ^ crc_register = (guint16) ((crc_register << 8) ^
@ -83,7 +81,7 @@ gst_dp_dump_byte_array (guint8 * array, guint length)
{ {
int i; int i;
int n = 8; /* number of bytes per line */ 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); GST_LOG ("dumping byte array of length %d", length);
for (i = 0; i < length; ++i) { 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); g_return_val_if_fail (header, FALSE);
*length = GST_DP_HEADER_LENGTH; *length = GST_DP_HEADER_LENGTH;
h = g_malloc (GST_DP_HEADER_LENGTH); h = g_malloc0 (GST_DP_HEADER_LENGTH);
/* version, flags, type */ /* version, flags, type */
h[0] = (guint8) GST_DP_VERSION_MAJOR; 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); g_return_val_if_fail (payload, FALSE);
*length = GST_DP_HEADER_LENGTH; *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); string = (guchar *) gst_caps_to_string (caps);