Commit 173bcb33 authored by jmvalin's avatar jmvalin
Browse files

Make sure we don't destroy user buffer when SpeexBits is destructed


git-svn-id: http://svn.xiph.org/trunk/speex@3815 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 040db452
......@@ -34,6 +34,7 @@ void speex_bits_init(SpeexBits *bits)
bits->nbBits=0;
bits->bytePtr=0;
bits->bitPtr=0;
bits->owner=1;
}
void speex_bits_init_buffer(SpeexBits *bits, void *buff)
......@@ -46,11 +47,13 @@ void speex_bits_init_buffer(SpeexBits *bits, void *buff)
bits->nbBits=0;
bits->bytePtr=0;
bits->bitPtr=0;
bits->owner=0;
}
void speex_bits_destroy(SpeexBits *bits)
{
speex_free(bits->bytes);
if (bits->owner)
speex_free(bits->bytes);
/* Will do something once the allocation is dynamic */
}
......
......@@ -34,6 +34,7 @@ typedef struct SpeexBits {
int nbBits;
int bytePtr;
int bitPtr;
int owner;
} SpeexBits;
/** Initializes and allocates resources for a SpeexBits struct */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment