[gnumeric] tsa: fix another crash.



commit 1d1a1c9b630282d2017061bf2b2cbf5c2026fa30
Author: Morten Welinder <terra gnome org>
Date:   Fri Jun 19 20:40:47 2009 -0400

    tsa: fix another crash.

 NEWS                       |    2 +-
 plugins/fn-tsa/ChangeLog   |    4 ++++
 plugins/fn-tsa/functions.c |    6 ++++++
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index b7b7e32..8203050 100644
--- a/NEWS
+++ b/NEWS
@@ -48,7 +48,7 @@ Morten:
 	* Fixed FIXED.  No, really.
 	* Start introducing external references for function docs.
 	* Implement new functions COTH and ACOTH.  [#586170]
-	* Fix tsa crash.  [#586191]
+	* Fix tsa crashes.  [#586191, #586427]
 	* Fix IF problems with empties and arrays.  [#586218, #586312]
 
 --------------------------------------------------------------------------
diff --git a/plugins/fn-tsa/ChangeLog b/plugins/fn-tsa/ChangeLog
index 809343e..ea2a336 100644
--- a/plugins/fn-tsa/ChangeLog
+++ b/plugins/fn-tsa/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-19  Morten Welinder  <terra gnome org>
+
+	* functions.c (gnumeric_periodogram): Fix another crash.  #586427.
+
 2009-06-18  Morten Welinder  <terra gnome org>
 
 	* functions.c (gnumeric_periodogram): Fix crash.  #586191.
diff --git a/plugins/fn-tsa/functions.c b/plugins/fn-tsa/functions.c
index 2a94c96..38e3514 100644
--- a/plugins/fn-tsa/functions.c
+++ b/plugins/fn-tsa/functions.c
@@ -838,6 +838,11 @@ gnumeric_periodogram (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 			interpolated[i] = start + i * incr;
 		g_free (ord);
 		ord = interpproc (absc, ord, n0, interpolated, n1);
+		if (ord == NULL) {
+			g_free (absc);
+			g_free (interpolated);
+			return value_new_error_std (ei->pos, GNM_ERROR_NA);
+		}
 		n0 = nb;
 	} else {
 		/* we have no interpolation to apply, so just take the values */
@@ -882,6 +887,7 @@ gnumeric_periodogram (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 	}
 
 	/* Transform and return the result */
+	g_printerr ("n0=%d nb=%d\n", n0, nb);
 	in = g_new0 (complex_t, nb);
 	for (i = 0; i < n0; i++)
 	     in[i].re = ord[i];



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