wendellchao / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

unarchive.c leaks memory when installing some packages #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

$ valgrind --leak-check=yes ./opkg-cl -o ~/opkg/ install libfribidi0

Output pasted below.

It looks like many improvements to libbb have been made in busybox' tree since 
it was imported into 
ipkg/opkg. Unfortunately, its not a drop in replacement for what we have and 
will require some work 
to merge.

==27913== Memcheck, a memory error detector
==27913== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==27913== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==27913== Command: ./opkg-cl -o /home/grg/opkg/ install libfribidi0
==27913== 
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 5,691,779 bytes in 205,208 blocks
==27913==   total heap usage: 396,476 allocs, 191,268 frees, 296,089,588 bytes 
allocated
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 0 bytes in 0 blocks
==27913==    still reachable: 5,691,779 bytes in 205,208 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 39 from 6)
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 5,765,085 bytes in 205,267 blocks
==27913==   total heap usage: 396,652 allocs, 191,385 frees, 296,107,864 bytes 
allocated
==27913== 
==27913== 656 bytes in 2 blocks are possibly lost in loss record 61 of 133
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064451: unzip (unzip.c:989)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x8058981: pkg_extract_data_file_names_to_stream 
(pkg_extract.c:171)
==27913==    by 0x8053BF4: pkg_get_installed_files (pkg.c:1390)
==27913==    by 0x804F22A: opkg_install_pkg (opkg_install.c:432)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913==    by 0x804A840: opkg_cmd_exec (opkg_cmd.c:150)
==27913== 
==27913== 5,480 bytes in 53 blocks are possibly lost in loss record 78 of 133
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064407: unzip (unzip.c:980)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x8058981: pkg_extract_data_file_names_to_stream 
(pkg_extract.c:171)
==27913==    by 0x8053BF4: pkg_get_installed_files (pkg.c:1390)
==27913==    by 0x804F22A: opkg_install_pkg (opkg_install.c:432)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913==    by 0x804A840: opkg_cmd_exec (opkg_cmd.c:150)
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 6,136 bytes in 55 blocks
==27913==    still reachable: 5,758,949 bytes in 205,212 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 39 from 6)
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 5,765,214 bytes in 205,272 blocks
==27913==   total heap usage: 396,729 allocs, 191,457 frees, 296,112,598 bytes 
allocated
==27913== 
==27913== 656 bytes in 2 blocks are possibly lost in loss record 65 of 137
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064451: unzip (unzip.c:989)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x8058981: pkg_extract_data_file_names_to_stream 
(pkg_extract.c:171)
==27913==    by 0x8053BF4: pkg_get_installed_files (pkg.c:1390)
==27913==    by 0x804DEC7: check_data_file_clashes (opkg_install.c:1255)
==27913==    by 0x804F9B3: opkg_install_pkg (opkg_install.c:961)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913== 
==27913== 5,480 bytes in 53 blocks are possibly lost in loss record 82 of 137
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064407: unzip (unzip.c:980)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x8058981: pkg_extract_data_file_names_to_stream 
(pkg_extract.c:171)
==27913==    by 0x8053BF4: pkg_get_installed_files (pkg.c:1390)
==27913==    by 0x804DEC7: check_data_file_clashes (opkg_install.c:1255)
==27913==    by 0x804F9B3: opkg_install_pkg (opkg_install.c:961)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 6,136 bytes in 55 blocks
==27913==    still reachable: 5,759,078 bytes in 205,217 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 39 from 6)
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 5,758,921 bytes in 205,217 blocks
==27913==   total heap usage: 396,626 allocs, 191,409 frees, 296,100,123 bytes 
allocated
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 0 bytes in 0 blocks
==27913==    still reachable: 5,758,921 bytes in 205,217 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 39 from 6)
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 5,764,854 bytes in 205,270 blocks
==27913==   total heap usage: 396,799 allocs, 191,529 frees, 296,117,989 bytes 
allocated
==27913== 
==27913== 656 bytes in 2 blocks are possibly lost in loss record 63 of 135
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064451: unzip (unzip.c:989)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x80589C5: pkg_extract_data_files_to_dir (pkg_extract.c:80)
==27913==    by 0x804E3BB: install_data_files (opkg_install.c:1551)
==27913==    by 0x804FBB9: opkg_install_pkg (opkg_install.c:1000)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913==    by 0x804A840: opkg_cmd_exec (opkg_cmd.c:150)
==27913== 
==27913== 5,480 bytes in 53 blocks are possibly lost in loss record 80 of 135
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064407: unzip (unzip.c:980)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x80589C5: pkg_extract_data_files_to_dir (pkg_extract.c:80)
==27913==    by 0x804E3BB: install_data_files (opkg_install.c:1551)
==27913==    by 0x804FBB9: opkg_install_pkg (opkg_install.c:1000)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913==    by 0x804A840: opkg_cmd_exec (opkg_cmd.c:150)
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 6,136 bytes in 55 blocks
==27913==    still reachable: 5,758,718 bytes in 205,215 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 39 from 6)
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 5,765,214 bytes in 205,272 blocks
==27913==   total heap usage: 396,843 allocs, 191,571 frees, 296,122,511 bytes 
allocated
==27913== 
==27913== 656 bytes in 2 blocks are possibly lost in loss record 65 of 137
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064451: unzip (unzip.c:989)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x8058981: pkg_extract_data_file_names_to_stream 
(pkg_extract.c:171)
==27913==    by 0x8053BF4: pkg_get_installed_files (pkg.c:1390)
==27913==    by 0x804DD74: check_data_file_clashes_change (opkg_install.c:1346)
==27913==    by 0x804FBC6: opkg_install_pkg (opkg_install.c:1003)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913== 
==27913== 5,480 bytes in 53 blocks are possibly lost in loss record 82 of 137
==27913==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
==27913==    by 0x806648C: xmalloc (xfuncs.c:32)
==27913==    by 0x8063101: huft_build (unzip.c:480)
==27913==    by 0x8064407: unzip (unzip.c:980)
==27913==    by 0x8062C5F: gz_open (gz_open.c:47)
==27913==    by 0x8062805: deb_extract (unarchive.c:774)
==27913==    by 0x8058981: pkg_extract_data_file_names_to_stream 
(pkg_extract.c:171)
==27913==    by 0x8053BF4: pkg_get_installed_files (pkg.c:1390)
==27913==    by 0x804DD74: check_data_file_clashes_change (opkg_install.c:1346)
==27913==    by 0x804FBC6: opkg_install_pkg (opkg_install.c:1003)
==27913==    by 0x8050218: opkg_install_by_name (opkg_install.c:218)
==27913==    by 0x804C238: opkg_install_cmd (opkg_cmd.c:566)
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 6,136 bytes in 55 blocks
==27913==    still reachable: 5,759,078 bytes in 205,217 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 39 from 6)
Installing libfribidi0 (0.10.4-r0.3) to root...
Downloading http://10.0.0.13/ipk/mipsel/libfribidi0_0.10.4-r0.3_mipsel.ipk
Configuring libfribidi0
(offline root mode: not running libfribidi0.postinst)
sh: rm: command not found
==27913== 
==27913== HEAP SUMMARY:
==27913==     in use at exit: 33,740 bytes in 2,319 blocks
==27913==   total heap usage: 410,401 allocs, 408,082 frees, 380,993,546 bytes 
allocated
==27913== 
==27913== LEAK SUMMARY:
==27913==    definitely lost: 0 bytes in 0 blocks
==27913==    indirectly lost: 0 bytes in 0 blocks
==27913==      possibly lost: 0 bytes in 0 blocks
==27913==    still reachable: 33,740 bytes in 2,319 blocks
==27913==         suppressed: 0 bytes in 0 blocks
==27913== Reachable blocks (those to which a pointer was found) are not shown.
==27913== To see them, rerun with: --leak-check=full --show-reachable=yes
==27913== 
==27913== For counts of detected and suppressed errors, rerun with: -v
==27913== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 39 from 6)

Original issue reported on code.google.com by graham.g...@gmail.com on 2 Nov 2009 at 6:21

GoogleCodeExporter commented 9 years ago
These leaks come from the child unzip process and are a result of the process 
being sent SIGTERM before 
completion.

Fixed with r310

Original comment by graham.g...@gmail.com on 15 Nov 2009 at 10:46