Re: Memory Leak in FreeAltScreen
"Daniel De Graaf" <[email protected]> Mon, 1 May 2006 18:34:29 -0500
| Newsgroups | gmane.comp.gnu.screen |
|---|---|
| Message-ID | <[email protected]> |
The free() is still needed; FreeMline() just frees the structures referenced by p->w_alt_hlines, not p->w_alt_hlines itself. Run under valgrind with and without the free()s, and switch to the altscreen a few times to see. - Daniel De Graaf On 5/1/06, Eric Wald <[email protected]> wrote: > Daniel De Graaf wrote: > > if (p->w_alt_mlines) > > for (i = 0; i < p->w_alt_height; i++) > > FreeMline(p->w_alt_mlines + i); > > + free(p->w_alt_mlines); > > [...] > > if (p->w_alt_hlines) > > for (i = 0; i < p->w_alt_histheight; i++) > > FreeMline(p->w_alt_hlines + i); > > + free(p->w_alt_hlines); > > It seems to me that the FreeMline() calls make the free() calls redundant. > Am I wrong? > > - Eric