]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
malloc calloc patch
authorMatthijs Mekking <matje@nlnetlabs.nl>
Fri, 11 Jul 2014 15:38:07 +0000 (15:38 +0000)
committerMatthijs Mekking <matje@nlnetlabs.nl>
Fri, 11 Jul 2014 15:38:07 +0000 (15:38 +0000)
git-svn-id: file:///svn/unbound/trunk@3173 be551aaa-1e26-0410-a405-d3ace91eadb9

compat/fake-rfc2553.c
doc/Changelog

index 91ddf8a809b6da2f5e970f80a36c5929dafb5085..0f0f34f1fb2dea10c943207b271e3bd4280bfff9 100644 (file)
@@ -120,12 +120,10 @@ addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints)
 {
        struct addrinfo *ai;
 
-       ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in));
+       ai = calloc(1, sizeof(*ai) + sizeof(struct sockaddr_in));
        if (ai == NULL)
                return (NULL);
        
-       memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in));
-       
        ai->ai_addr = (struct sockaddr *)(ai + 1);
        /* XXX -- ssh doesn't use sa_len */
        ai->ai_addrlen = sizeof(struct sockaddr_in);
index 0b5db07658e96957446012db15c76f01f006a31e..f68baaf1688aa229e4be26110151ce1cbaa68895 100644 (file)
@@ -1,3 +1,6 @@
+11 July 2014: Matthijs
+       - fake-rfc2553 patch (thanks Benjamin Baier).
+
 11 July 2014: Wouter
        - arc4random in compat/ and getentropy, explicit_bzero, chacha for
          dependencies, from OpenBSD.  arc4_lock and sha512 in compat.