pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ods-reader memory leak


From: Ben Pfaff
Subject: ods-reader memory leak
Date: Wed, 14 Mar 2012 22:27:32 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

There's a memory leak in an error path.  Here's a fix.  It
doesn't report the error; do you think that we should?

(Reporting the leak will require a minor test update: test 180
provokes an error.)

--8<--------------------------cut here-------------------------->8--

>From ad8d77988813df8b3744cb67755c61f18721496d Mon Sep 17 00:00:00 2001
From: Ben Pfaff <address@hidden>
Date: Wed, 14 Mar 2012 22:25:00 -0700
Subject: [PATCH] ods-reader: Fix memory leak.

Found by valgrind.
---
 src/data/ods-reader.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/data/ods-reader.c b/src/data/ods-reader.c
index aedea07..9c165f9 100644
--- a/src/data/ods-reader.c
+++ b/src/data/ods-reader.c
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 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
@@ -324,11 +324,11 @@ convert_xml_to_value (struct ccase *c, const struct 
variable *var,
       text =
         xmv->value ? CHAR_CAST (const char *, xmv->value) : CHAR_CAST (const 
char *, xmv->text);
 
-      data_in (ss_cstr (text), "UTF-8",
-              fmt->type,
-              v,
-              var_get_width (var),
-              "UTF-8");
+      free (data_in (ss_cstr (text), "UTF-8",
+                     fmt->type,
+                     v,
+                     var_get_width (var),
+                     "UTF-8"));
     }
 }
 
-- 
1.7.2.5


-- 
Ben Pfaff 
http://benpfaff.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]