From: Alan H. <al...@us...> - 2006-01-21 05:28:39
|
Graham, Since you no longer do a free on lastData, does this mean we have a =20 memory leak now? Alan ______ Alan Humpherys Fire Development Team al...@us... http://www.fireim.org On Jan 20, 2006, at 7:31 PM, gb...@us... wrote: > Author: gbooker > Date: 2006-01-21 15:31:19 +1300 (Sat, 21 Jan 2006) > New Revision: 4803 > > Modified: > branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m > Log: > Alan and I seem to think that this is the final fix for the Speech =20 > crashes. > > > Modified: branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m =20 > 2006-01-21 02:24:41 UTC (rev 4802) > +++ branches/Fire-1-5-Update/fire/SpeechUtilities/SUSpeaker.m =20 > 2006-01-21 02:31:19 UTC (rev 4803) > @@ -82,6 +82,7 @@ > _volume =3D 1 << 16; > > NewSpeechChannel(NULL, &_speechChannel); // NULL voice is =20 > default voice > + lastData =3D NULL; > [self setCallbacks]; > return self; > } > @@ -151,11 +152,11 @@ > //finished =3D NO; > [self stopSpeaking]; > NSData *data =3D [text dataUsingEncoding:[NSString =20 > defaultCStringEncoding] allowLossyConversion:YES]; > - if(lastData !=3D NULL) > - free(lastData); > - lastData =3D (void *)malloc([data length]); > + int length =3D [data length]; > + lastData =3D (void *)malloc(length+1); > [data getBytes:lastData]; > - SpeakText(_speechChannel, lastData, [data length]); > + ((unsigned char *)lastData)[length] =3D '\0'; > + SpeakText(_speechChannel, lastData, length); > //while(!finished); > //sleep(2); > } > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through =20 > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD =20 > SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=103432&bid#0486&dat=121642= > _______________________________________________ > Fire-commits mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/fire-commits |