diff src/xs_length.c @ 472:3f02945a0c48

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Jan 2007 05:58:05 +0000
parents d600f45c92d2
children c67a7f2fd586
line wrap: on
line diff
--- a/src/xs_length.c	Thu Jan 25 03:51:01 2007 +0000
+++ b/src/xs_length.c	Thu Jan 25 05:58:05 2007 +0000
@@ -148,9 +148,14 @@
 			}
 			
 			/* Allocate memory for lengths */
-			tmpNode->sLengths = (gint *) g_malloc0(tmpNode->nLengths * sizeof(gint));
-			if (!tmpNode->sLengths) {
-				xs_error(_("Could not allocate memory for node.\n"));
+			if (tmpNode->nLengths > 0) {
+				tmpNode->sLengths = (gint *) g_malloc0(tmpNode->nLengths * sizeof(gint));
+				if (!tmpNode->sLengths) {
+					xs_error(_("Could not allocate memory for node.\n"));
+					xs_sldb_node_free(tmpNode);
+					return NULL;
+				}
+			} else {
 				xs_sldb_node_free(tmpNode);
 				return NULL;
 			}