From c17d125985a980c82ed292aa82f744924b81fa6a Mon Sep 17 00:00:00 2001 From: "jdunn%netscape.com" Date: Wed, 12 Apr 2000 14:42:40 +0000 Subject: [PATCH] Initialize the vars and make sure we 'NULL' them after we free them. On HP (for example) there isn't a sound shared lib, so we ended up freeing an uninitialized pointer. r= dougt@netscape.com git-svn-id: svn://10.0.0.236/trunk@65717 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/gtk/nsSound.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mozilla/widget/src/gtk/nsSound.cpp b/mozilla/widget/src/gtk/nsSound.cpp index a1fca1ab5bb..0c7d96df249 100644 --- a/mozilla/widget/src/gtk/nsSound.cpp +++ b/mozilla/widget/src/gtk/nsSound.cpp @@ -86,6 +86,10 @@ nsSound::nsSound() { NS_INIT_REFCNT(); mInited = PR_FALSE; + + mPlayBuf = NULL; + mBuffer = NULL; + mBufferSize = 0; } nsSound::~nsSound() @@ -98,10 +102,8 @@ nsSound::~nsSound() (*EsdClose)(esdref); esdref = -1; } - if (mPlayBuf) - PR_Free( mPlayBuf ); - if (mBuffer) - PR_Free( mBuffer ); + PR_FREEIF( mPlayBuf ); + PR_FREEIF( mBuffer ); mInited = PR_FALSE; }