William Egert <[email protected]> writes: > I agree. I was just testing out that CppCheck software, I will report the > false positive to them. > > Thanks for your understanding! :)
Don't worry, tools like that are very useful and it is important to run it against libidn to find problems. Thanks for thinking about testing libidn in this aspect. Setting up auto-mated testing would be useful, maybe it can help to catch problems introduced in the future. /Simon > -Bill > > On Tue, Feb 24, 2009 at 4:50 AM, Simon Josefsson <[email protected]>wrote: > >> William Egert <[email protected]> writes: >> >> > Running http://cppcheck.wiki.sourceforge.net/ reports: >> > >> > [lib/toutf8.c:122]: (always) Memory leak: p >> > >> > for version 1.12 of libidn >> >> Hi. Thanks for the report. I would say it is a false positive, the >> code reads: >> >> ... >> * Return value: Returns newly allocated zero-terminated string which >> * is @str transcoded into to_codeset. >> **/ >> char * >> stringprep_convert (const char *str, >> const char *to_codeset, const char *from_codeset) >> { >> #if HAVE_ICONV >> return str_iconv (str, from_codeset, to_codeset); >> #else >> char *p; >> fprintf (stderr, "libidn: warning: libiconv not installed, cannot " >> "convert data to UTF-8\n"); >> p = malloc (strlen (str) + 1); >> if (!p) >> return NULL; >> return strcpy (p, str); >> #endif >> } >> >> I'm assuming you've tested the !HAVE_ICONV code path. >> >> The function is documented to return a pointer to newly allocated >> storage. If the function is used as documented, and the caller >> de-allocate the string after use, I don't see how there is a memory >> leak. What do you think? >> >> /Simon >> _______________________________________________ Help-libidn mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-libidn
