[Scummvm-devel] Re: [Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.30,1.31
Max Horn
max at quendi.de
Thu Jul 24 06:17:08 CEST 2003
Am Donnerstag, 24.07.03 um 14:05 Uhr schrieb Travis Howell:
> Update of /cvsroot/scummvm/scummvm/simon
> In directory sc8-pr-cvs1:/tmp/cvs-serv29413/simon
>
> Modified Files:
> sound.cpp
> Log Message:
>
> Check before releasing memory
>
>
> Index: sound.cpp
> ===================================================================
> RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
> retrieving revision 1.30
> retrieving revision 1.31
> diff -u -d -r1.30 -r1.31
> --- sound.cpp 24 Jul 2003 10:20:56 -0000 1.30
> +++ sound.cpp 24 Jul 2003 12:05:06 -0000 1.31
> @@ -422,6 +422,9 @@
> }
> }
>
> + if (_voice)
> + delete _voice;
> +
> _voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
> }
>
> @@ -434,6 +437,9 @@
> if (file->isOpen() == false) {
> warning("Can't open voice file %s", filename);
> } else {
> + if (_voice)
> + delete _voice;
> +
> _voice = new WavSound(_mixer, file, _offsets);
> }
> }
That makes no sense! "delete 0" is legal and perfectly valid according
to the ISO C++ standard. Hence that code is 100% equivalent to the old
code, i.e. this:
if (_voice)
delete _voice;
is equivalent to
delete _voice;
More information about the Scummvm-devel
mailing list