[libgdata/clang: 2/8] [core] Fix potential use of NULL in memcpy()



commit 448e26226ba370336fb8160f47b206689cfa63b8
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Sat Aug 7 19:21:45 2010 +0100

    [core] Fix potential use of NULL in memcpy()

 gdata/gdata-buffer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-buffer.c b/gdata/gdata-buffer.c
index dc0ab83..18f1395 100644
--- a/gdata/gdata-buffer.c
+++ b/gdata/gdata-buffer.c
@@ -135,7 +135,8 @@ gdata_buffer_push_data (GDataBuffer *self, const guint8 *data, gsize length)
 	chunk->next = NULL;
 
 	/* Copy the data to the chunk */
-	memcpy (chunk->data, data, length);
+	if (G_LIKELY (data != NULL))
+		memcpy (chunk->data, data, length);
 
 	/* Add it to the buffer's tail */
 	if (self->tail != NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]