changeset 429:a991d1fe7e94

Bugfixes
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Jan 2007 08:09:00 +0000
parents 33c3bb80d2a5
children d787dae8c043
files src/xs_stil.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_stil.c	Mon Jan 01 08:07:05 2007 +0000
+++ b/src/xs_stil.c	Mon Jan 01 08:09:00 2007 +0000
@@ -34,7 +34,7 @@
 static gboolean xs_stildb_node_realloc(t_xs_stil_node *pNode, gint nsubTunes)
 {
 	if (!pNode) return FALSE;
-	
+
 	/* Re-allocate subTune structure if needed */
 	if (nsubTunes >= pNode->nsubTunes) {
 		pNode->subTunes =
@@ -48,10 +48,9 @@
 		
 		/* Clear the newly allocated memory */
 		xs_memset(&(pNode->subTunes[pNode->nsubTunes]), 0,
-			(nsubTunes + 1 - pNode->nsubTunes) *
-			sizeof(t_xs_stil_subnode **));
+		(nsubTunes - pNode->nsubTunes + 1) * sizeof(t_xs_stil_subnode **));
 		
-		pNode->nsubTunes = nsubTunes + 1;
+		pNode->nsubTunes = nsubTunes;
 	}
 
 	/* Allocate memory for subTune */
@@ -76,7 +75,7 @@
 
 	if (pNode) {
 		/* Free subtune information */
-		for (i = 0; i < pNode->nsubTunes; i++) {
+		for (i = 0; i <= pNode->nsubTunes; i++) {
 			pSub = pNode->subTunes[i];
 			if (pSub) {
 				g_free(pSub->pName);