[gnumeric] nlsolve: plug leak.



commit 605a6271627ddb649c387cf6eb214f4c355ae70e
Author: Morten Welinder <terra gnome org>
Date:   Tue Jan 6 19:35:15 2015 -0500

    nlsolve: plug leak.

 plugins/nlsolve/ChangeLog     |    4 ++++
 plugins/nlsolve/gnm-nlsolve.c |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/plugins/nlsolve/ChangeLog b/plugins/nlsolve/ChangeLog
index e74e373..6493289 100644
--- a/plugins/nlsolve/ChangeLog
+++ b/plugins/nlsolve/ChangeLog
@@ -1,3 +1,7 @@
+2015-01-06  Morten Welinder  <terra gnome org>
+
+       * gnm-nlsolve.c (gnm_nlsolve_final): Plug leak.
+
 2014-09-25  Morten Welinder <terra gnome org>
 
        * Release 1.12.18
diff --git a/plugins/nlsolve/gnm-nlsolve.c b/plugins/nlsolve/gnm-nlsolve.c
index 25aec11..ed35213 100644
--- a/plugins/nlsolve/gnm-nlsolve.c
+++ b/plugins/nlsolve/gnm-nlsolve.c
@@ -52,6 +52,8 @@ typedef struct {
        guint idle_tag;
 } GnmNlsolve;
 
+static void free_matrix (gnm_float **m, int n);
+
 static void
 gnm_nlsolve_cleanup (GnmNlsolve *nl)
 {
@@ -64,11 +66,18 @@ gnm_nlsolve_cleanup (GnmNlsolve *nl)
 static void
 gnm_nlsolve_final (GnmNlsolve *nl)
 {
+       const int n = nl->vars->len;
+
        gnm_nlsolve_cleanup (nl);
        if (nl->vars)
                g_ptr_array_free (nl->vars, TRUE);
        g_free (nl->xk);
        g_free (nl->x0);
+       if (nl->xi) {
+               free_matrix (nl->xi, n);
+               nl->xi = NULL;
+       }
+
        g_free (nl);
 }
 


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