heimdal: Fix CID 241943 Uninitialized pointer read
authorVolker Lendecke <vl@samba.org>
Mon, 11 Nov 2013 21:07:09 +0000 (21:07 +0000)
committerAndreas Schneider <asn@samba.org>
Wed, 13 Nov 2013 08:01:55 +0000 (09:01 +0100)
In the error case without EXTRA_ADDRESSES we access ignore_addresses
without initialization

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/heimdal/lib/krb5/get_addrs.c

index 0e2bfcf66f946fa9cfae1d62a9781461d9dc98ab..765badb289b3577528da499a971ed8ba88633f91 100644 (file)
@@ -130,7 +130,8 @@ find_all_addresses (krb5_context context, krb5_addresses *res, int flags)
     /* Allocate storage for them. */
     res->val = calloc(num, sizeof(*res->val));
     if (res->val == NULL) {
-       krb5_free_addresses(context, &ignore_addresses);
+       if (flags & EXTRA_ADDRESSES)
+           krb5_free_addresses(context, &ignore_addresses);
        freeifaddrs(ifa0);
        krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
        return ENOMEM;