krb5_locate_kdc() in source/libsmb/clikrb5.c

Jeremy Allison jra at samba.org
Mon Dec 20 20:42:13 GMT 2004


On Mon, Dec 20, 2004 at 02:35:17PM -0600, Albert Chin wrote:
> Function krb5_locate_kdc() in source/libsmb/clikrb5.c (SAMBA_3_0
> branch) has the following:
> #if !defined(HAVE_KRB5_LOCATE_KDC)
>  krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters)
> {
>         ...
>         *addr_pp = NULL;
>         ...
>         *addr_pp = SMB_MALLOC(sizeof(struct sockaddr) * num_kdcs);
>         memset(*addr_pp, '\0', sizeof(struct sockaddr) * num_kdcs );
>         ...
>         *naddrs = num_kdcs;
>         *addr_pp = sa;
>         return 0;
> }
> #endif
> 
> What's the point of malloc()'ing memory for *addr_pp when it's never
> used? Maybe you mean to memset (*sa, ...)?

Good catch - a memory leak ! Thanks, I'll fix this in SVN.

Jeremy.


More information about the samba-technical mailing list