From 70f8feea0e76d9aaae3656f886729b2c6ea3c2c1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 20 Feb 2016 20:29:38 -0800 Subject: [PATCH] table: Fix memory leak. table_create_nested_item() was documented to take ownership of its argument but in fact it took a reference on it, creating a leak. Found by valgrind. Reported by John Darrington. Bug #47074. --- src/output/table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output/table.c b/src/output/table.c index 0667c06735..e354bb3edf 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2011, 2014 Free Software Foundation, Inc. + Copyright (C) 2009, 2011, 2014, 2016 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -367,7 +367,7 @@ table_create_nested_item (struct table_item *inner) struct table_nested *tn = xmalloc (sizeof *tn); table_init (&tn->table, &table_nested_class); tn->table.n[TABLE_HORZ] = tn->table.n[TABLE_VERT] = 1; - tn->inner = table_item_ref (inner); + tn->inner = inner; return &tn->table; } -- 2.30.2