[goffice] Regression: fix memory handling.



commit cb07d965b23e47258140d72a798fe104e45c5026
Author: Morten Welinder <terra gnome org>
Date:   Thu Jan 24 12:57:39 2013 -0500

    Regression: fix memory handling.

 ChangeLog                    |    6 ++++++
 goffice/math/go-regression.c |    5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8986985..70e8759 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-24  Morten Welinder  <terra gnome org>
+
+	* goffice/math/go-regression.c (go_linear_regression_leverage):
+	Fix cleanup.
+	(QRH): Fix cleanup in the error case.
+
 2013-01-22  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/graph/gog-series-labels.c (gog_series_labels_class_init): really
diff --git a/goffice/math/go-regression.c b/goffice/math/go-regression.c
index de837f7..f3f8dbd 100644
--- a/goffice/math/go-regression.c
+++ b/goffice/math/go-regression.c
@@ -413,7 +413,8 @@ SUFFIX(QRH) (CONSTMATRIX A, gboolean qAT,
 			Rfinal[i][j] = R[i][j];
 
 out:
-	FREE_MATRIX (R, m, n);
+	if (R)
+		FREE_MATRIX (R, m, n);
 	g_free (tmp);
 
 	return ok;
@@ -2123,7 +2124,7 @@ SUFFIX(go_linear_regression_leverage) (MATRIX A, DOUBLE *d, int m, int n)
 	} else
 		regres = GO_REG_invalid_data;
 
-	FREE_MATRIX (V, n, n);
+	FREE_MATRIX (V, m, n);
 	FREE_MATRIX (R, n, n);
 
 	SUFFIX(go_quad_end) (state);



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