[openssl-dev] [openssl.org #4220] Simple BIO demo make memory leak

wangjin via RT rt at openssl.org
Wed Jan 6 17:15:58 UTC 2016


 

Dear,

 

Recently, I got an issue on my RHEL6.5 x64 platform with original
openssl-1.0.2e  without patch.  Please find the attached files for testing
demo, this simple demo will generate Memory Leak, is it a bug ? I am not
sure why?  Thank you for in advance.

 

The same test on Win7 x64, VS2008, appear again.

 

Best Regards,

  _____  

Jin Linux


-------------- next part --------------
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "openssl/bio.h"

int main(int argc, char* argv[])
{
	BIO* b = NULL;

	b = BIO_new(BIO_s_mem());
	/* here is not free totally.
	 * I strace and found that, BIO_free() is not 
	 * free the inner lhash and stack structure.
	 */
	BIO_free_all(b);
//  or BIO_free();
	
	return 0;
}
-------------- next part --------------
>>>>GCC version
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) 


>>> uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux


>>> valgrind ./bio_mem
==14689== Memcheck, a memory error detector
==14689== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==14689== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==14689== Command: ./bio_mem
==14689== 
==14689== Conditional jump or move depends on uninitialised value(s)
==14689==    at 0x355F417FE6: index (strchr.S:55)
==14689==    by 0x355F4075A2: expand_dynamic_string_token (dl-load.c:425)
==14689==    by 0x355F4079DD: _dl_map_object (dl-load.c:2301)
==14689==    by 0x355F40196D: map_doit (rtld.c:626)
==14689==    by 0x355F40E7B5: _dl_catch_error (dl-error.c:177)
==14689==    by 0x355F401886: do_preload (rtld.c:815)
==14689==    by 0x355F403A8C: dl_main (rtld.c:1629)
==14689==    by 0x355F415AA5: _dl_sysdep_start (dl-sysdep.c:249)
==14689==    by 0x355F401412: _dl_start (rtld.c:331)
==14689==    by 0x355F400AE7: ??? (in /lib64/ld-2.18.so)
==14689== 
==14689== Conditional jump or move depends on uninitialised value(s)
==14689==    at 0x355F417FEB: index (strchr.S:58)
==14689==    by 0x355F4075A2: expand_dynamic_string_token (dl-load.c:425)
==14689==    by 0x355F4079DD: _dl_map_object (dl-load.c:2301)
==14689==    by 0x355F40196D: map_doit (rtld.c:626)
==14689==    by 0x355F40E7B5: _dl_catch_error (dl-error.c:177)
==14689==    by 0x355F401886: do_preload (rtld.c:815)
==14689==    by 0x355F403A8C: dl_main (rtld.c:1629)
==14689==    by 0x355F415AA5: _dl_sysdep_start (dl-sysdep.c:249)
==14689==    by 0x355F401412: _dl_start (rtld.c:331)
==14689==    by 0x355F400AE7: ??? (in /lib64/ld-2.18.so)
==14689== 
==14689== 
==14689== HEAP SUMMARY:
==14689==     in use at exit: 416 bytes in 6 blocks
==14689==   total heap usage: 8 allocs, 2 frees, 552 bytes allocated
==14689== 
==14689== LEAK SUMMARY:
==14689==    definitely lost: 0 bytes in 0 blocks
==14689==    indirectly lost: 0 bytes in 0 blocks
==14689==      possibly lost: 0 bytes in 0 blocks
==14689==    still reachable: 416 bytes in 6 blocks
==14689==         suppressed: 0 bytes in 0 blocks
==14689== Rerun with --leak-check=full to see details of leaked memory
==14689== 
==14689== For counts of detected and suppressed errors, rerun with: -v
==14689== Use --track-origins=yes to see where uninitialised values come from
==14689== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

-------------- next part --------------
_______________________________________________
openssl-bugs-mod mailing list
openssl-bugs-mod at openssl.org
https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod


More information about the openssl-dev mailing list