]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Use t_new in complicated t_malloc_no0 calls
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Tue, 17 May 2016 07:56:53 +0000 (10:56 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 30 May 2016 18:35:24 +0000 (21:35 +0300)
src/auth/auth-request-var-expand.c
src/lib-http/http-transfer-chunked.c
src/lib/net.c

index 3b0013601ea347ac52fb00fbb80ee4162393a014..7bbceed854e5c03dce5bf8c9cf699936cfdf1942 100644 (file)
@@ -78,8 +78,7 @@ auth_request_get_var_expand_table_full(const struct auth_request *auth_request,
 
        /* keep the extra fields at the beginning. the last static_tab field
           contains the ending NULL-fields. */
-       tab = ret_tab = t_malloc_no0((*count + auth_count) * sizeof(*tab));
-       memset(tab, 0, *count * sizeof(*tab));
+       tab = ret_tab = t_new(struct var_expand_table, *count + auth_count);
        tab += *count;
        *count += auth_count;
 
index fff71cf931ed3e696085ff8bd56ab7132a0a6238..ac738749ea0bc090e388803c876d23852850ccbd 100644 (file)
@@ -623,7 +623,7 @@ http_transfer_chunked_ostream_sendv(struct ostream_private *stream,
        /* create new iovec */
        prefix = t_strdup_printf("%llx\r\n", (unsigned long long)tcstream->chunk_size);
        iov_count = iov_count_new + 2;
-       iov_new = t_malloc_no0(sizeof(struct const_iovec) * iov_count);
+       iov_new = t_new(struct const_iovec, iov_count);
        iov_new[0].iov_base = prefix;
        iov_new[0].iov_len = strlen(prefix);
        memcpy(&iov_new[1], iov, sizeof(struct const_iovec) * iov_count_new);
index 5cfc91b2d512dcf07e21a0ef138011f4540c7e0a..33186791e5ae798f1d6aaf84efab1dae8f8709ce 100644 (file)
@@ -651,7 +651,7 @@ int net_gethostbyname(const char *addr, struct ip_addr **ips,
                 count++;
 
         *ips_count = count;
-        *ips = t_malloc_no0(sizeof(struct ip_addr) * count);
+        *ips = t_new(struct ip_addr, count);
 
         count = 0;
        for (ai = origai; ai != NULL; ai = ai->ai_next, count++) {