[splint-discuss] problem with function inet_ntoa()
Vishal Bayskar
vishal.bayskar at nechclst.in
Mon Mar 31 05:36:45 PST 2008
Dear All,
There is a problem with function inet_ntoa
Following line is used in the code
strcpy (ip_addr, inet_ntoa (((struct sockaddr_in *)
&ifr.ifr_addr)->sin_addr));
this line is not called in loop
here ip_addr is declare as
static char ip_addr[MAX_IPLEN];
When I run the splint, it is giving the following warning is displaying
New fresh storage (type char *) passed as implicitly temp
(not released): inet_ntoa(((struct sockaddr_in
*)&ifr.ifr_ifru.ifru_addr)->s
in_addr)
A memory leak has been detected. Storage allocated locally is not
released
before the last reference to it is lost. (Use -mustfreefresh to
inhibit
Does it really do with inet_ntoa() function ?
Like if we read manual of it
We can find the sentence that
The inet_ntoa() function converts the Internet host address in given
in network byte order to a string in standard numbers-and-dots notation.
The string is returned in a statically allocated buffer, which
subsequent calls will overwrite.
Please not that
inet_ntoa() is called only ones
Thank in advance
I really thank for the response that I am getting on this blog.
Thanks and Regards
Vishal Bayskar
Ext. no. 927
Disclaimer:
This message and any attachment(s) contained here are information that is confidential, proprietary to NEC HCL System Technologies and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the individual or the entity it is addressed to. If you are not the intended recipient of this message, you are not authorized to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20080331/72f2f701/attachment-0001.html
More information about the splint-discuss
mailing list