From: Gerfried Fuchs Date: Fri, 13 Aug 2010 21:13:48 +0000 (+0200) Subject: New patch fix-memory-leak X-Git-Tag: debian/0.52-9~2 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=614219dca397988b0c2003148ced5570026926df;p=pkg%2Fnetris.git New patch fix-memory-leak --- diff --git a/debian/changelog b/debian/changelog index 31be698..6989134 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 index 0000000..c975dc4 --- /dev/null +++ b/debian/patches/10_fix-memory-leak @@ -0,0 +1,26 @@ +Author: TomaszN 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); + } + + /* diff --git a/debian/patches/series b/debian/patches/series index 885489d..da7920d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,3 +7,4 @@ 07_curses.c-include-time.h 08_various-fixes 09_ipv6 +10_fix-memory-leak