changeset 1044:a5b785c12340

Avoid cppcheck warning
author Thorsten Horstmann <thorsten.horstmann@web.de>
date Tue, 24 Feb 2015 22:41:26 +0800
parents 38d2f6b2d1b8
children 31727a8abd4b
files buffer.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/buffer.c	Tue Feb 24 22:36:20 2015 +0800
+++ b/buffer.c	Tue Feb 24 22:41:26 2015 +0800
@@ -99,7 +99,9 @@
 
 	ret = buf_new(buf->len);
 	ret->len = buf->len;
-	memcpy(ret->data, buf->data, buf->len);
+	if (buf->len > 0) {
+	    memcpy(ret->data, buf->data, buf->len);
+	}
 	return ret;
 }