zero allocated class memory
This commit is contained in:
parent
189267013e
commit
a7e4fb2629
@ -254,6 +254,7 @@ FLAC__BitBuffer *FLAC__bitbuffer_new()
|
|||||||
FLAC__BitBuffer *bb = (FLAC__BitBuffer*)malloc(sizeof(FLAC__BitBuffer));
|
FLAC__BitBuffer *bb = (FLAC__BitBuffer*)malloc(sizeof(FLAC__BitBuffer));
|
||||||
|
|
||||||
if(0 != bb) {
|
if(0 != bb) {
|
||||||
|
memset(bb, 0, sizeof(FLAC__BitBuffer));
|
||||||
bb->buffer = 0;
|
bb->buffer = 0;
|
||||||
bb->capacity = 0;
|
bb->capacity = 0;
|
||||||
bb->blurbs = bb->bits = bb->total_bits = 0;
|
bb->blurbs = bb->bits = bb->total_bits = 0;
|
||||||
|
@ -99,20 +99,24 @@ FLAC__FileDecoder *FLAC__file_decoder_new()
|
|||||||
if(decoder == 0) {
|
if(decoder == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder, 0, sizeof(FLAC__FileDecoder));
|
||||||
|
|
||||||
decoder->protected_ = (FLAC__FileDecoderProtected*)malloc(sizeof(FLAC__FileDecoderProtected));
|
decoder->protected_ = (FLAC__FileDecoderProtected*)malloc(sizeof(FLAC__FileDecoderProtected));
|
||||||
if(decoder->protected_ == 0) {
|
if(decoder->protected_ == 0) {
|
||||||
free(decoder);
|
free(decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder->protected_, 0, sizeof(FLAC__FileDecoderProtected));
|
||||||
|
|
||||||
decoder->private_ = (FLAC__FileDecoderPrivate*)malloc(sizeof(FLAC__FileDecoderPrivate));
|
decoder->private_ = (FLAC__FileDecoderPrivate*)malloc(sizeof(FLAC__FileDecoderPrivate));
|
||||||
if(decoder->private_ == 0) {
|
if(decoder->private_ == 0) {
|
||||||
free(decoder->protected_);
|
free(decoder->protected_);
|
||||||
free(decoder);
|
free(decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder->private_, 0, sizeof(FLAC__FileDecoderPrivate));
|
||||||
|
|
||||||
decoder->private_->seekable_stream_decoder = FLAC__seekable_stream_decoder_new();
|
decoder->private_->seekable_stream_decoder = FLAC__seekable_stream_decoder_new();
|
||||||
|
|
||||||
if(0 == decoder->private_->seekable_stream_decoder) {
|
if(0 == decoder->private_->seekable_stream_decoder) {
|
||||||
free(decoder->private_);
|
free(decoder->private_);
|
||||||
free(decoder->protected_);
|
free(decoder->protected_);
|
||||||
|
@ -125,20 +125,24 @@ FLAC__SeekableStreamDecoder *FLAC__seekable_stream_decoder_new()
|
|||||||
if(decoder == 0) {
|
if(decoder == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder, 0, sizeof(FLAC__SeekableStreamDecoder));
|
||||||
|
|
||||||
decoder->protected_ = (FLAC__SeekableStreamDecoderProtected*)malloc(sizeof(FLAC__SeekableStreamDecoderProtected));
|
decoder->protected_ = (FLAC__SeekableStreamDecoderProtected*)malloc(sizeof(FLAC__SeekableStreamDecoderProtected));
|
||||||
if(decoder->protected_ == 0) {
|
if(decoder->protected_ == 0) {
|
||||||
free(decoder);
|
free(decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder->protected_, 0, sizeof(FLAC__SeekableStreamDecoderProtected));
|
||||||
|
|
||||||
decoder->private_ = (FLAC__SeekableStreamDecoderPrivate*)malloc(sizeof(FLAC__SeekableStreamDecoderPrivate));
|
decoder->private_ = (FLAC__SeekableStreamDecoderPrivate*)malloc(sizeof(FLAC__SeekableStreamDecoderPrivate));
|
||||||
if(decoder->private_ == 0) {
|
if(decoder->private_ == 0) {
|
||||||
free(decoder->protected_);
|
free(decoder->protected_);
|
||||||
free(decoder);
|
free(decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder->private_, 0, sizeof(FLAC__SeekableStreamDecoderPrivate));
|
||||||
|
|
||||||
decoder->private_->stream_decoder = FLAC__stream_decoder_new();
|
decoder->private_->stream_decoder = FLAC__stream_decoder_new();
|
||||||
|
|
||||||
if(0 == decoder->private_->stream_decoder) {
|
if(0 == decoder->private_->stream_decoder) {
|
||||||
free(decoder->private_);
|
free(decoder->private_);
|
||||||
free(decoder->protected_);
|
free(decoder->protected_);
|
||||||
|
@ -146,17 +146,23 @@ FLAC__StreamDecoder *FLAC__stream_decoder_new()
|
|||||||
if(decoder == 0) {
|
if(decoder == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder, 0, sizeof(FLAC__StreamDecoder));
|
||||||
|
|
||||||
decoder->protected_ = (FLAC__StreamDecoderProtected*)malloc(sizeof(FLAC__StreamDecoderProtected));
|
decoder->protected_ = (FLAC__StreamDecoderProtected*)malloc(sizeof(FLAC__StreamDecoderProtected));
|
||||||
if(decoder->protected_ == 0) {
|
if(decoder->protected_ == 0) {
|
||||||
free(decoder);
|
free(decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder->protected_, 0, sizeof(FLAC__StreamDecoderProtected));
|
||||||
|
|
||||||
decoder->private_ = (FLAC__StreamDecoderPrivate*)malloc(sizeof(FLAC__StreamDecoderPrivate));
|
decoder->private_ = (FLAC__StreamDecoderPrivate*)malloc(sizeof(FLAC__StreamDecoderPrivate));
|
||||||
if(decoder->private_ == 0) {
|
if(decoder->private_ == 0) {
|
||||||
free(decoder->protected_);
|
free(decoder->protected_);
|
||||||
free(decoder);
|
free(decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
memset(decoder->private_, 0, sizeof(FLAC__StreamDecoderPrivate));
|
||||||
|
|
||||||
decoder->private_->input = FLAC__bitbuffer_new();
|
decoder->private_->input = FLAC__bitbuffer_new();
|
||||||
if(decoder->private_->input == 0) {
|
if(decoder->private_->input == 0) {
|
||||||
free(decoder->private_);
|
free(decoder->private_);
|
||||||
|
Loading…
Reference in New Issue
Block a user