# HG changeset patch # User Matti Hamalainen # Date 1167638940 0 # Node ID a991d1fe7e94bdf3944fc06b215440dc6c4a06b0 # Parent 33c3bb80d2a5f9bfb40fb4cd275106ed1bee236c Bugfixes diff -r 33c3bb80d2a5 -r a991d1fe7e94 src/xs_stil.c --- 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);