From 5fe5f5f46ddc01fd0e32180ae5a4420085c05735 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Sun, 13 Jul 2008 16:58:20 +0000 Subject: [PATCH] * symtab.c (expand_line_sal): Fix a memory leak. --- gdb/ChangeLog | 4 ++++ gdb/symtab.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a592d20ed1..2d28e92764 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2008-07-13 Hui Zhu + + * symtab.c (expand_line_sal): Fix a memory leak. + 2008-07-13 Pedro Alves * utils.c (struct continuation): Define as inheriting struct diff --git a/gdb/symtab.c b/gdb/symtab.c index 0466490edd..f676a0cc11 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4456,8 +4456,8 @@ expand_line_sal (struct symtab_and_line sal) blocks -- for each PC found above we see if there are other PCs that are in the same block. If yes, the other PCs are filtered out. */ - filter = xmalloc (ret.nelts * sizeof (int)); - blocks = xmalloc (ret.nelts * sizeof (struct block *)); + filter = alloca (ret.nelts * sizeof (int)); + blocks = alloca (ret.nelts * sizeof (struct block *)); for (i = 0; i < ret.nelts; ++i) { filter[i] = 1; -- 2.11.0