Your message dated Fri, 14 Apr 2017 10:49:30 +0000
with message-id <[email protected]>
and subject line Bug#783486: fixed in ncurses 6.0+20170408-1
has caused the Debian Bug report #783486,
regarding two memory leaks in ncurses newterm()
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
783486: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=783486
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ncurses
Version: 5.9+20140913-1

The attached program does newterm() multiple times, depending on how it
is invoked, tearing down the screen with delscreen() each time.

There is one leak per invocation of newterm(), a malloc in
_nc_setupscreen.

When linked against libncursesw instead of libncurses, there is an extra
leak for every newterm() in _nc_init_wacs() (except for the first
invocation of newterm(), which appears to actually get cleaned up
properly).


It's possible that we think these links are no big deal, and that any
program using libncurses won't care.  In that case, please supply
a suppression file for valgrind to avoid extra noise for people
debugging ncurses programs.


Background: 

I built the attached source twice, (against libncurses and libncursesw)
like this:

-------------------
#!/usr/bin/make -f
ncurses: ncurses.c
        gcc -g --pedantic -Wall -lncurses -o $@ $<

ncursesw: ncurses.c
        gcc -g --pedantic -Wall -lncursesw -o $@ $<
-------------------

here are the valgrind comparisons with the different runs (note the
Command: on each comparison):

--- /dev/fd/63  2015-04-20 10:15:44.427927773 -0300
+++ /dev/fd/62  2015-04-20 10:15:44.427927773 -0300
@@ -1,15 +1,28 @@
  Memcheck, a memory error detector
  Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
- Command: ./ncurses 0 /dev/pts/10
+ Command: ./ncurses 1 /dev/pts/10
  Parent PID: 13345
  
  
  HEAP SUMMARY:
-     in use at exit: 0 bytes in 0 blocks
-   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+     in use at exit: 2,418 bytes in 2 blocks
+   total heap usage: 103 allocs, 101 frees, 63,155 bytes allocated
  
- All heap blocks were freed -- no leaks are possible
+ 2,408 bytes in 1 blocks are definitely lost in loss record 2 of 2
+    at 0x4C28C20: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
+    by 0x4E48A64: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
+    by 0x4E45E6D: newterm (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
+    by 0x400810: main (ncurses.c:15)
+ 
+ LEAK SUMMARY:
+    definitely lost: 2,408 bytes in 1 blocks
+    indirectly lost: 0 bytes in 0 blocks
+      possibly lost: 0 bytes in 0 blocks
+    still reachable: 10 bytes in 1 blocks
+         suppressed: 0 bytes in 0 blocks
+ Reachable blocks (those to which a pointer was found) are not shown.
+ To see them, rerun with: --leak-check=full --show-leak-kinds=all
  
  For counts of detected and suppressed errors, rerun with: -v
- ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+ ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
--- /dev/fd/63  2015-04-20 10:15:44.435927809 -0300
+++ /dev/fd/62  2015-04-20 10:15:44.435927809 -0300
@@ -1,25 +1,25 @@
  Memcheck, a memory error detector
  Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
- Command: ./ncurses 1 /dev/pts/10
+ Command: ./ncurses 2 /dev/pts/10
  Parent PID: 13345
  
  
  HEAP SUMMARY:
-     in use at exit: 2,418 bytes in 2 blocks
-   total heap usage: 103 allocs, 101 frees, 63,155 bytes allocated
+     in use at exit: 4,965 bytes in 5 blocks
+   total heap usage: 204 allocs, 199 frees, 125,305 bytes allocated
  
- 2,408 bytes in 1 blocks are definitely lost in loss record 2 of 2
+ 4,816 bytes in 2 blocks are definitely lost in loss record 4 of 4
     at 0x4C28C20: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
     by 0x4E48A64: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
     by 0x4E45E6D: newterm (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
     by 0x400810: main (ncurses.c:15)
  
  LEAK SUMMARY:
-    definitely lost: 2,408 bytes in 1 blocks
+    definitely lost: 4,816 bytes in 2 blocks
     indirectly lost: 0 bytes in 0 blocks
       possibly lost: 0 bytes in 0 blocks
-    still reachable: 10 bytes in 1 blocks
+    still reachable: 149 bytes in 3 blocks
          suppressed: 0 bytes in 0 blocks
  Reachable blocks (those to which a pointer was found) are not shown.
  To see them, rerun with: --leak-check=full --show-leak-kinds=all
--- /dev/fd/63  2015-04-20 10:22:32.713789856 -0300
+++ /dev/fd/62  2015-04-20 10:22:32.713789856 -0300
@@ -1,25 +1,25 @@
  Memcheck, a memory error detector
  Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
- Command: ./ncurses 1 /dev/pts/10
+ Command: ./ncursesw 1 /dev/pts/10
  Parent PID: 13345
  
  
  HEAP SUMMARY:
-     in use at exit: 2,418 bytes in 2 blocks
-   total heap usage: 103 allocs, 101 frees, 63,155 bytes allocated
+     in use at exit: 6,653 bytes in 5 blocks
+   total heap usage: 105 allocs, 100 frees, 217,621 bytes allocated
  
- 2,408 bytes in 1 blocks are definitely lost in loss record 2 of 2
+ 2,408 bytes in 1 blocks are definitely lost in loss record 4 of 5
     at 0x4C28C20: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
-    by 0x4E48A64: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
-    by 0x4E45E6D: newterm (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
-    by 0x400810: main (ncurses.c:15)
+    by 0x4E4CB54: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x4E498CD: newterm (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x400820: main (ncurses.c:15)
  
  LEAK SUMMARY:
     definitely lost: 2,408 bytes in 1 blocks
     indirectly lost: 0 bytes in 0 blocks
       possibly lost: 0 bytes in 0 blocks
-    still reachable: 10 bytes in 1 blocks
+    still reachable: 4,245 bytes in 4 blocks
          suppressed: 0 bytes in 0 blocks
  Reachable blocks (those to which a pointer was found) are not shown.
  To see them, rerun with: --leak-check=full --show-leak-kinds=all
--- /dev/fd/63  2015-04-20 10:15:44.439927827 -0300
+++ /dev/fd/62  2015-04-20 10:15:44.439927827 -0300
@@ -1,28 +1,35 @@
  Memcheck, a memory error detector
  Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
- Command: ./ncurses 2 /dev/pts/10
+ Command: ./ncursesw 2 /dev/pts/10
  Parent PID: 13345
  
  
  HEAP SUMMARY:
-     in use at exit: 4,965 bytes in 5 blocks
-   total heap usage: 204 allocs, 199 frees, 125,305 bytes allocated
+     in use at exit: 13,157 bytes in 7 blocks
+   total heap usage: 206 allocs, 199 frees, 434,217 bytes allocated
  
- 4,816 bytes in 2 blocks are definitely lost in loss record 4 of 4
+ 4,096 bytes in 1 blocks are definitely lost in loss record 5 of 6
+    at 0x4C2AD10: calloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
+    by 0x4E6169E: _nc_init_wacs (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x4E4CE3A: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x4E498CD: newterm (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x400820: main (ncurses.c:15)
+ 
+ 4,816 bytes in 2 blocks are definitely lost in loss record 6 of 6
     at 0x4C28C20: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
-    by 0x4E48A64: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
-    by 0x4E45E6D: newterm (in /lib/x86_64-linux-gnu/libncurses.so.5.9)
-    by 0x400810: main (ncurses.c:15)
+    by 0x4E4CB54: _nc_setupscreen (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x4E498CD: newterm (in /lib/x86_64-linux-gnu/libncursesw.so.5.9)
+    by 0x400820: main (ncurses.c:15)
  
  LEAK SUMMARY:
-    definitely lost: 4,816 bytes in 2 blocks
+    definitely lost: 8,912 bytes in 3 blocks
     indirectly lost: 0 bytes in 0 blocks
       possibly lost: 0 bytes in 0 blocks
-    still reachable: 149 bytes in 3 blocks
+    still reachable: 4,245 bytes in 4 blocks
          suppressed: 0 bytes in 0 blocks
  Reachable blocks (those to which a pointer was found) are not shown.
  To see them, rerun with: --leak-check=full --show-leak-kinds=all
  
  For counts of detected and suppressed errors, rerun with: -v
- ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
+ ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)


Thanks for maintaining curses in debian!

       --dkg

#include <curses.h>
#include <stdlib.h>
#include <stdio.h>

int
main(int argc, const char* argv[])
{
  SCREEN* screen;
  int z = atoi(argv[1]);
  int j;
  FILE *i, *o;
  for (j = 0; j < z; j++) {
    i = fopen(argv[2], "r");
    o = fopen(argv[2], "w");
    screen = newterm(NULL, o, i);
    delscreen(screen);
    fclose(i);
    fclose(o);
  }
  return 0;
}

--- End Message ---
--- Begin Message ---
Source: ncurses
Source-Version: 6.0+20170408-1

We believe that the bug you reported is fixed in the latest version of
ncurses, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Sven Joachim <[email protected]> (supplier of updated ncurses package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Fri, 14 Apr 2017 12:21:10 +0200
Source: ncurses
Binary: libtinfo5 libtinfo5-udeb libncurses5 libtinfo-dev libtinfo5-dbg 
libncurses5-dev libncurses5-dbg libncursesw5 libncursesw5-dev libncursesw5-dbg 
lib64ncurses5 lib64ncurses5-dev lib32ncurses5 lib32ncurses5-dev lib32ncursesw5 
lib32ncursesw5-dev lib64tinfo5 lib32tinfo5 lib32tinfo-dev ncurses-bin 
ncurses-base ncurses-term ncurses-examples ncurses-doc
Architecture: source
Version: 6.0+20170408-1
Distribution: experimental
Urgency: low
Maintainer: Craig Small <[email protected]>
Changed-By: Sven Joachim <[email protected]>
Description:
 lib32ncurses5 - shared libraries for terminal handling (32-bit)
 lib32ncurses5-dev - developer's libraries for ncurses (32-bit)
 lib32ncursesw5 - shared libraries for terminal handling (wide character 
support) (
 lib32ncursesw5-dev - developer's libraries for ncursesw (32-bit)
 lib32tinfo-dev - developer's library for the low-level terminfo library 
(32-bit)
 lib32tinfo5 - shared low-level terminfo library for terminal handling (32-bit)
 lib64ncurses5 - shared libraries for terminal handling (64-bit)
 lib64ncurses5-dev - developer's libraries for ncurses (64-bit)
 lib64tinfo5 - shared low-level terminfo library for terminal handling (64-bit)
 libncurses5 - shared libraries for terminal handling
 libncurses5-dbg - debugging/profiling libraries for ncurses
 libncurses5-dev - developer's libraries for ncurses
 libncursesw5 - shared libraries for terminal handling (wide character support)
 libncursesw5-dbg - debugging/profiling libraries for ncursesw
 libncursesw5-dev - developer's libraries for ncursesw
 libtinfo-dev - developer's library for the low-level terminfo library
 libtinfo5  - shared low-level terminfo library for terminal handling
 libtinfo5-dbg - debugging/profiling library for the low-level terminfo library
 libtinfo5-udeb - shared low-level terminfo library for terminal handling - 
udeb (udeb)
 ncurses-base - basic terminal type definitions
 ncurses-bin - terminal-related programs and man pages
 ncurses-doc - developer's guide and documentation for ncurses
 ncurses-examples - test programs and examples for ncurses
 ncurses-term - additional terminal type definitions
Closes: 783486 859293
Changes:
 ncurses (6.0+20170408-1) experimental; urgency=low
 .
   * New upstream patchlevel.
     - Fix a memory leak in the window-list when creating multiple
       screens (reports by Andres Martinelli, Closes: #783486).
   * Provide a curses(3) symlink to ncurses (Closes: #859293).
   * Set LD_LIBRARY_PATH when building the test programs, fixes an
     impending FTBFS when we switch to libncursesw6 from libncursesw5.
   * Update years in debian/copyright.
   * Change priority of libncurses5 to optional (see #852002).
Checksums-Sha1:
 73c0f0b21b9d1f52c26f5ef1d885b468387b7f3d 3756 ncurses_6.0+20170408-1.dsc
 751adc7772bf9837d957a8a18004d12de0162145 3249501 
ncurses_6.0+20170408.orig.tar.gz
 37748af3a1c830e6aed1e06be42b67d6a5c6ca3e 52800 
ncurses_6.0+20170408-1.debian.tar.xz
 62d37d3963440edc14ed99a3566eb7645af7a41f 7389 
ncurses_6.0+20170408-1_source.buildinfo
Checksums-Sha256:
 2bf15cf97c322adba6b105801dd919e1def407b13bcaa254a75678276ff665ea 3756 
ncurses_6.0+20170408-1.dsc
 4276ca4b0eb883e7d314572271f79250f47b2f4842b735e89076f239d3513cb9 3249501 
ncurses_6.0+20170408.orig.tar.gz
 a694c897e91d73c0495ccf4ac684eca596930d3f8bbaae33f0f36379d9a9321e 52800 
ncurses_6.0+20170408-1.debian.tar.xz
 2b999687346a06b36e1634c4055f07023ea04d808f7ee12f0fadbd53491668ea 7389 
ncurses_6.0+20170408-1_source.buildinfo
Files:
 fd83918e7686f6ea3cfbf67c475e0f02 3756 libs required ncurses_6.0+20170408-1.dsc
 22743141ecdaa95ada274d1fd3200fdf 3249501 libs required 
ncurses_6.0+20170408.orig.tar.gz
 ce8b9c623676d56f6d8f6ee9854edf8f 52800 libs required 
ncurses_6.0+20170408-1.debian.tar.xz
 14759a6c3c1c8f1b3207981f7736776f 7389 libs required 
ncurses_6.0+20170408-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKF8heKgv5Jai5p4QOxBucY1rMawFAljwo6sACgkQOxBucY1r
Mazv5RAAkPsj1RwAtBjIWfAVguQQGy6KpG/NGnfHVFqs5fJ3Q4dE8V4OQffhTRd3
vME9ZjHr/KBOgJg91Yw9OIA179Mib08L84GzTjiCXxqNVMZG9Xaz0mRtYXIFfFES
EWsKd0mnml7ve9rL7VkTlw7tFu+89BtidN2uShnkAhTAKSh1XyXrMxagIjDogHyM
7BEhMP3u3GoY7BcDAYpAs9gaJwngqqUvhs2vF3cDiWS/ZNiXJirkrwNiPFN+jy49
+tFXJZiwp481kZvRzFoIZbW52F0MYONTtJl6qGzU5lgeNx7Wgy+pNXpMnbLlKPeV
T2n5mno5goxUbTieftnq6GDcUs8paik2+tud/uUkx7oNveWR5YHS5bnjs7Owq+qV
VpQ5SNVQwTwp2L6n2UWfFW52ignyg1s1/mz94chtgS8Q8I6dsazN7+qMA2aSLc/L
8/4uOPGFa8xi9T6bG4QocnDZTX1p1mlOfELmmS9guPllDGAm30aoWKdnIMVi74hY
9Me+Rl/vg0SolnpcnbZ4RE3P4MNmxlOshcONRum7I8t12C1XzFZuLxsuowPMpDnK
Q5dAy892GqNw+ENuG+Ggnhv0rwMUuWepW1U9D13BYEwGQKdWMt2ubOTpP699t34n
6RPvGheIFBkExVvl4p0bxNQqMDfZIbKsFsEx0MJ5PhzNfbGX0wI=
=3b87
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to