# HG changeset patch # User Thorsten Horstmann # Date 1424788886 -28800 # Node ID a5b785c1234077430617cd4346100aa95a1595de # Parent 38d2f6b2d1b879913ee20b43da2865cf8e0b1ffb Avoid cppcheck warning diff -r 38d2f6b2d1b8 -r a5b785c12340 buffer.c --- 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; }