summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-10-22 21:45:12 +0100
committerLars Wirzenius <liw@liw.fi>2010-10-22 21:45:12 +0100
commite795b6cea64b3bba3c8b3dc2f643ca65fcf1b604 (patch)
tree2e0511e4e8d959fe3cb01632dd89bf1cd5e220ef
parent6ce25cc8ce53e53aadb0f7a5be20759e2d398a7e (diff)
downloaddynstr-e795b6cea64b3bba3c8b3dc2f643ca65fcf1b604.tar.gz
Fix accesses of uninitialized memory reported by valgrind.
-rw-r--r--unittests.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unittests.c b/unittests.c
index c1438ce..e6caa0a 100644
--- a/unittests.c
+++ b/unittests.c
@@ -206,7 +206,7 @@ static int test_creates_from_cstring(void)
size = dynstr_memcpy(newbytes, dynstr, 0, strlen(bytes));
FAIL_UNLESS_EQUAL(size, strlen(bytes));
- FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, sizeof(bytes)), 0);
+ FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, strlen(bytes)), 0);
dynstr_free(dynstr);
return true;
@@ -244,11 +244,11 @@ static int test_creates_from_constant_cstring(void)
size = dynstr_memcpy(newbytes, dynstr, 0, strlen(bytes));
FAIL_UNLESS_EQUAL(size, strlen(bytes));
- FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, sizeof(bytes)), 0);
+ FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, strlen(bytes)), 0);
bytes[0] = 'x';
dynstr_memcpy(newbytes, dynstr, 0, strlen(bytes));
- FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, sizeof(bytes)), 0);
+ FAIL_UNLESS_EQUAL(memcmp(bytes, newbytes, strlen(bytes)), 0);
dynstr_free(dynstr);
return true;