From: Stephan Bosch Date: Thu, 12 Apr 2018 21:01:03 +0000 (+0200) Subject: lib-mail: test-message-address: Use i_memdup() rather than explicit malloc(), memcpy(). X-Git-Tag: 2.3.2.rc1~171 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e1682d44349b91c0d4167d8b1346e6ca1a6c85e;p=thirdparty%2Fdovecot%2Fcore.git lib-mail: test-message-address: Use i_memdup() rather than explicit malloc(), memcpy(). --- diff --git a/src/lib-mail/test-message-address.c b/src/lib-mail/test-message-address.c index a37ae7303e..8fe9989f0d 100644 --- a/src/lib-mail/test-message-address.c +++ b/src/lib-mail/test-message-address.c @@ -25,8 +25,7 @@ test_parse_address(const char *input, bool fill_missing) /* duplicate the input (without trailing NUL) so valgrind notices if there's any out-of-bounds access */ size_t input_len = strlen(input); - unsigned char *input_dup = i_malloc(input_len); - memcpy(input_dup, input, input_len); + unsigned char *input_dup = i_memdup(input, input_len); const struct message_address *addr = message_address_parse(pool_datastack_create(), input_dup, input_len, UINT_MAX, fill_missing); @@ -329,8 +328,7 @@ test_parse_path(const char *input, const struct message_address **addr_r) /* duplicate the input (without trailing NUL) so valgrind notices if there's any out-of-bounds access */ size_t input_len = strlen(input); - unsigned char *input_dup = i_malloc(input_len); - memcpy(input_dup, input, input_len); + unsigned char *input_dup = i_memdup(input, input_len); ret = message_address_parse_path(pool_datastack_create(), input_dup, input_len, &addr); i_free(input_dup);