New patch fix-memory-leak
authorGerfried Fuchs <rhonda@debian.at>
Fri, 13 Aug 2010 21:13:48 +0000 (23:13 +0200)
committerGerfried Fuchs <rhonda@debian.at>
Fri, 13 Aug 2010 21:13:48 +0000 (23:13 +0200)
debian/changelog
debian/patches/10_fix-memory-leak [new file with mode: 0644]
debian/patches/series

index 31be698..6989134 100644 (file)
@@ -3,6 +3,8 @@ netris (0.52-9) unstable; urgency=low
   * Add Vcs-* fields.
   * Bump Standards-Version to 3.9.1.
   * Relicense packaging under WTFPLv2.
+  * New patch fix-memory-leak to fix a memory leak and adding another memory
+    related check. Thanks to TomaszN (closes: #590952)
 
  -- 
 
diff --git a/debian/patches/10_fix-memory-leak b/debian/patches/10_fix-memory-leak
new file mode 100644 (file)
index 0000000..c975dc4
--- /dev/null
@@ -0,0 +1,26 @@
+Author: TomaszN <nowak2000@poczta.onet.pl>     vim:ft=diff:
+Description: fix memory leak issue, BTS #590942
+
+Index: b/curses.c
+===================================================================
+--- a/curses.c
++++ b/curses.c
+@@ -141,6 +141,8 @@ ExtFunc void GetTermcapInfo(void)
+                * Allocate it on the heap too.
+                */
+               data = buf = malloc(bufSize);
++              if (buf == NULL)
++                      fatal("memory allocation error");
+               /*
+                * There is no standard include file for tgetstr, no prototype
+@@ -154,9 +156,6 @@ ExtFunc void GetTermcapInfo(void)
+               /* Okay, so I'm paranoid; I just don't like unsafe routines */
+               if (data > buf + bufSize)
+                       fatal("tgetstr overflow, you must have a very sick termcap");
+-
+-              /* Trim off the unused portion of buffer */
+-              buf = realloc(buf, data - buf);
+       }
+       /*
index 885489d..da7920d 100644 (file)
@@ -7,3 +7,4 @@
 07_curses.c-include-time.h
 08_various-fixes
 09_ipv6
+10_fix-memory-leak