Okay, so as long I don't call gethostbyname() again, I can just pass around pointers to its stuff?
Here's a weird thing about in_addr: inet_aton() actually outputs into a struct in_addr*. If you do this:
Code:
struct in_addr netaddr;
char *ascaddr;
inet_aton(ascaddr,&netaddr);
It passes the compiler but the contents of netaddr end up bogus. I have to do this:
Code:
struct in_addr netaddr, *ptr=&netaddr;
char *ascaddr;
inet_aton(ascaddr,ptr);
to get it to work
ps. would malloc'ing "test" then etc. explain why freeing them would be a double free? Or should I still be looking for memory corruption?