Hello to all. As the e server is down, I'm sending this report to this
mailing list.

I think there's a memory leak in eet when openssl is used as cipher engine.

I wrote a small test case, which is attached, as well the output of the
executable in valgrind (--tool=memcheck and --leak-check=full).

I'm using eet 1.7.1 and openssl 1.0.1c.

-- 
-----
Sent from my Atari
==18560== Memcheck, a memory error detector
==18560== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==18560== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info
==18560== Command: ./eet_openssl_leak
==18560== 
==18560== 
==18560== HEAP SUMMARY:
==18560==     in use at exit: 936 bytes in 9 blocks
==18560==   total heap usage: 27,354 allocs, 27,341 frees, 7,939,069 bytes 
allocated
==18560== 
==18560== 312 bytes in 3 blocks are definitely lost in loss record 1 of 3
==18560==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==18560==    by 0x47BBD3: CRYPTO_malloc (in /tmp/captura/test/eet_openssl_leak)
==18560==    by 0x483077: EVP_DigestInit_ex (in 
/tmp/captura/test/eet_openssl_leak)
==18560==    by 0x47C52A: HMAC_Init_ex.constprop.0 (in 
/tmp/captura/test/eet_openssl_leak)
==18560==    by 0x43FC9B: eet_pbkdf2_sha1 (eet_cipher.c:1365)
==18560==    by 0x43F3E2: eet_cipher (eet_cipher.c:985)
==18560==    by 0x4396F8: eet_write_cipher (eet_lib.c:2399)
==18560==    by 0x4348F5: main (eet_openssl_leak.c:21)
==18560== 
==18560== 312 bytes in 3 blocks are definitely lost in loss record 2 of 3
==18560==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==18560==    by 0x47BBD3: CRYPTO_malloc (in /tmp/captura/test/eet_openssl_leak)
==18560==    by 0x483077: EVP_DigestInit_ex (in 
/tmp/captura/test/eet_openssl_leak)
==18560==    by 0x47C703: HMAC_Init_ex.constprop.0 (in 
/tmp/captura/test/eet_openssl_leak)
==18560==    by 0x43FC9B: eet_pbkdf2_sha1 (eet_cipher.c:1365)
==18560==    by 0x43F3E2: eet_cipher (eet_cipher.c:985)
==18560==    by 0x4396F8: eet_write_cipher (eet_lib.c:2399)
==18560==    by 0x4348F5: main (eet_openssl_leak.c:21)
==18560== 
==18560== 312 bytes in 3 blocks are definitely lost in loss record 3 of 3
==18560==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==18560==    by 0x47BBD3: CRYPTO_malloc (in /tmp/captura/test/eet_openssl_leak)
==18560==    by 0x48367E: EVP_MD_CTX_copy_ex (in 
/tmp/captura/test/eet_openssl_leak)
==18560==    by 0x47C5A2: HMAC_Init_ex.constprop.0 (in 
/tmp/captura/test/eet_openssl_leak)
==18560==    by 0x43FC9B: eet_pbkdf2_sha1 (eet_cipher.c:1365)
==18560==    by 0x43F3E2: eet_cipher (eet_cipher.c:985)
==18560==    by 0x4396F8: eet_write_cipher (eet_lib.c:2399)
==18560==    by 0x4348F5: main (eet_openssl_leak.c:21)
==18560== 
==18560== LEAK SUMMARY:
==18560==    definitely lost: 936 bytes in 9 blocks
==18560==    indirectly lost: 0 bytes in 0 blocks
==18560==      possibly lost: 0 bytes in 0 blocks
==18560==    still reachable: 0 bytes in 0 blocks
==18560==         suppressed: 0 bytes in 0 blocks
==18560== 
==18560== For counts of detected and suppressed errors, rerun with: -v
==18560== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 2 from 2)

#include <Eet.h>
#include <Eina.h>

int main()
{
  eina_init();
  eet_init();
  
  Eet_File *file = eet_open("file.eet",EET_FILE_MODE_READ_WRITE);
  
  int size = 1024 * 1024;
  
  char *buffer = (char *)malloc(size);
  
  int i = 0;
  for (; i<size; i++) {
    buffer[i] = 'a';
  }
  
  // leak here
  eet_write_cipher(file,"key",buffer,size,0,"1234567890");
 
  // no leak here
  eet_write(file,"key",buffer,size,0);
  
  eet_close(file);
  
  free(buffer);
  
  eet_shutdown();
  
  eina_shutdown();
}
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to