[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#3440) Memory leak in debug build for VxWorks



Full_Name: Ian Puleston
Version: 2.2.17
OS: VxWorks
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (64.220.173.243)


This is not really a bug but an incompatibility with VxWorks that can easily be
fixed.

The VxWorks implementation of inet_ntoa() requires that the memory of the
returned string be freed, and that results in a memory leak in
ldap_connect_to_host() in a debug build of the client libraries for VxWorks. To
fix it, change the following code in ldap_connect_to_host() in libldap/os-ip.c:

		osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", 
			inet_ntoa(sin.sin_addr), port, 0);

to:

#ifdef VXWORKS
#ifdef LDAP_DEBUG
		{
			/* The VxWorks implementation of inet_ntoa requires a free() */
			char *p = inet_ntoa(sin.sin_addr);
			if (p) {
				osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", 
					p, port, 0);
				free(p);
			}
		}
#endif
#else
		osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", 
			inet_ntoa(sin.sin_addr), port, 0);
#endif