]> git.deb.at Git - pkg/netris.git/blob - debian/patches/10_fix-memory-leak
New patch fix-memory-leak
[pkg/netris.git] / debian / patches / 10_fix-memory-leak
1 Author: TomaszN <nowak2000@poczta.onet.pl>      vim:ft=diff:
2 Description: fix memory leak issue, BTS #590942
3
4 Index: b/curses.c
5 ===================================================================
6 --- a/curses.c
7 +++ b/curses.c
8 @@ -141,6 +141,8 @@ ExtFunc void GetTermcapInfo(void)
9                  * Allocate it on the heap too.
10                  */
11                 data = buf = malloc(bufSize);
12 +               if (buf == NULL)
13 +                       fatal("memory allocation error");
14  
15                 /*
16                  * There is no standard include file for tgetstr, no prototype
17 @@ -154,9 +156,6 @@ ExtFunc void GetTermcapInfo(void)
18                 /* Okay, so I'm paranoid; I just don't like unsafe routines */
19                 if (data > buf + bufSize)
20                         fatal("tgetstr overflow, you must have a very sick termcap");
21 -
22 -               /* Trim off the unused portion of buffer */
23 -               buf = realloc(buf, data - buf);
24         }
25  
26         /*