Update of /cvsroot/audacity/lib-src/libnyquist
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17229

Modified Files:
        nyquist.patch 
Log Message:
Fix stack overflow due to recursion.


Index: nyquist.patch
===================================================================
RCS file: /cvsroot/audacity/lib-src/libnyquist/nyquist.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- nyquist.patch       1 Mar 2009 07:23:28 -0000       1.4
+++ nyquist.patch       1 Mar 2009 21:09:48 -0000       1.5
@@ -349,9 +349,9 @@
      /* printf("GENERIC FREE %x SIZE %d\n", sp, nnn); */ \
      if ((sIzE) >= MAXLISTS) { \
          free(sp); \
-diff -wruN orig/nyquist/nyqsrc/sound.c nyquist/nyqsrc/sound.c
+diff -ruN orig/nyquist/nyqsrc/sound.c nyquist/nyqsrc/sound.c
 --- orig/nyquist/nyqsrc/sound.c        2008-07-20 23:30:05.000000000 -0500
-+++ nyquist/nyqsrc/sound.c     2009-02-25 09:08:55.000000000 -0600
++++ nyquist/nyqsrc/sound.c     2009-03-01 15:08:21.000000000 -0600
 @@ -17,7 +17,9 @@
  #include "extern.h"
  #include "debug.h"
@@ -362,7 +362,70 @@
  #include "cext.h"
  #include "userio.h"
  
-@@ -1085,8 +1087,10 @@
+@@ -504,33 +506,39 @@
+ void snd_list_unref(snd_list_type list)
+ {
+     void (*freefunc)();
++    snd_list_type next;
+ 
+-    if (list == NULL || list == zero_snd_list) {
+-        if (list == NULL)
++    while (list != zero_snd_list) {
++        if (list == NULL) {
+            nyquist_printf("why did snd_list_unref get %p?\n", list);
+-        return;
+-    }
+-    list->refcnt--;
+-/*    nyquist_printf("snd_list_unref "); print_snd_list_type(list); 
stdputstr("\n"); */
+-    if (list->refcnt == 0) {
+-        if (list->block && list->block != zero_block) {
+-            /* there is a next snd_list */
+-/*          stdputstr("["); */
+-            sample_block_unref(list->block);
+-/*          stdputstr("]"); */
+-            snd_list_unref(list->u.next);
++           return;
+         }
+-        else if (list->block == NULL) { /* the next thing is the susp */
+-            /* free suspension structure */
+-            /* nyquist_printf("freeing s...@%p\n", list->u.susp); */
+-            freefunc = list->u.susp->free;
+-            (*freefunc)(list->u.susp);
++        next = zero_snd_list;
++
++        list->refcnt--;
++/*      nyquist_printf("snd_list_unref "); print_snd_list_type(list); 
stdputstr("\n"); */
++        if (list->refcnt == 0) {
++            if (list->block && list->block != zero_block) {
++                /* there is a next snd_list */
++/*              stdputstr("["); */
++                sample_block_unref(list->block);
++/*              stdputstr("]"); */
++                next = list->u.next;
++            }
++            else if (list->block == NULL) { /* the next thing is the susp */
++                /* free suspension structure */
++                /* nyquist_printf("freeing s...@%p\n", list->u.susp); */
++                freefunc = list->u.susp->free;
++                (*freefunc)(list->u.susp);
++            }
++            /* nyquist_printf("freeing snd_l...@%p\n", list); */
++            //DBY
++            if (list == list_watch) printf("freeing watched snd_list %p\n", 
list);
++            //DBY
++            ffree_snd_list(list, "snd_list_unref");
+         }
+-        /* nyquist_printf("freeing snd_l...@%p\n", list); */
+-        //DBY
+-        if (list == list_watch) printf("freeing watched snd_list %p\n", list);
+-        //DBY
+-        ffree_snd_list(list, "snd_list_unref");
++
++        list = next;
+     }
+ }
+ 
+@@ -1085,8 +1093,10 @@
      /* this should never happen */
      if (*cnt == 0) {
          stdputstr("SND_get_first returned 0 samples\n");


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to