help-libidn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memory leak


From: Olga Limburg
Subject: memory leak
Date: Mon, 2 May 2011 22:49:02 +0400

Hello,
I think that I have found a memory leak in Libidn.

Code: main.cpp
Test: test.txt

When I run valgrind it reports a memory leak:

valgrind --tool=memcheck --leak-check=full  ./main < test.txt
==19727== Memcheck, a memory error detector
==19727== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==19727== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==19727== Command: ./main
==19727==
==19727==
==19727== HEAP SUMMARY:
==19727==     in use at exit: 26 bytes in 3 blocks
==19727==   total heap usage: 56 allocs, 53 frees, 9,553 bytes allocated
==19727==
==19727== For counts of detected and suppressed errors, rerun with: -v
==19727== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4)

My patch for idna.c (http://www.gnu.org/software/libidn/doxygen/idna_8c_source.html):


00508         {
00509           rc = idna_to_ascii_4i (start, (size_t) (end - start), buf, flags);
00510           if (rc != IDNA_SUCCESS)
-                 return rc;
+                 {
+                   free (out);
+                   return rc;
+                 }
00512           }

Regards,
Olga.

Attachment: test.txt
Description: Text document

Attachment: main.cpp
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]