]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: test-message-address: Use i_memdup() rather than explicit malloc(), memcpy().
authorStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 12 Apr 2018 21:01:03 +0000 (23:01 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 25 Apr 2018 08:12:06 +0000 (11:12 +0300)
src/lib-mail/test-message-address.c

index a37ae7303e025e03360d4297c9f1866139b4dd64..8fe9989f0dfa5a3c7d729208c5cbf6569d3af3df 100644 (file)
@@ -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);