Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 616108 Details for
Bug 859717
memory leak with getaddrinfo()
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
example code to recreate the memory leak
leak.c (text/plain), 1.10 KB, created by
Noam Meltzer
on 2012-09-23 14:04:46 UTC
(
hide
)
Description:
example code to recreate the memory leak
Filename:
MIME Type:
Creator:
Noam Meltzer
Created:
2012-09-23 14:04:46 UTC
Size:
1.10 KB
patch
obsolete
>#include <stdio.h> >#include <sys/types.h> >#include <sys/socket.h> >#include <netdb.h> >#include <string.h> >#include <errno.h> > >int ip_from_string(const char *s, struct in6_addr *ip, int *ip_af) >{ > int rc = 0; > int family; > void *ptr; > size_t sz; > struct addrinfo *ai = NULL; > > errno = 0; > rc = getaddrinfo(s, NULL, NULL, &ai); > if (rc != 0) { > printf("no-getaddrinfo; s=%s; %s\n", s, gai_strerror(rc)); > goto return_rc; > } > > family = ai->ai_family; > > switch (family) > { > case AF_INET: > ptr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr; > sz = sizeof(struct in_addr); > break; > case AF_INET6: > ptr = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr; > sz = sizeof(struct in6_addr); > break; > default: > printf("unsupported address family: %i\n", family); > rc = -1; > goto return_rc; > break; > } > > memcpy(ip, ptr, sz); > *ip_af = family; > >return_rc: > if (ai != NULL) { > printf("trying to free\n"); > freeaddrinfo(ai); > } > return rc; >} > >int main(int argc, char *argv[]) >{ > struct in6_addr ip; > int ip_af; > int rc; > > rc = ip_from_string(argv[1], &ip, &ip_af); > printf("ip_from_string rc=%i\n", rc); > > return rc; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 859717
: 616108