]> git.deb.at Git - pkg/netris.git/blobdiff - debian/patches/10_fix-memory-leak
New patch fix-memory-leak
[pkg/netris.git] / debian / patches / 10_fix-memory-leak
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);
+       }
+       /*