Commit 78d232c1 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry
Browse files

Fix an unchecked allocation.

Also mark other allocation failures with our unlikely macro.
parent 680139b2
Pipeline #2746 passed with stage
in 55 seconds
......@@ -1549,7 +1549,7 @@ static int op_open_seekable2(OggOpusFile *_of){
start_op_count=_of->op_count;
/*This is a bit too large to put on the stack unconditionally.*/
op_start=(ogg_packet *)_ogg_malloc(sizeof(*op_start)*start_op_count);
if(op_start==NULL)return OP_EFAULT;
if(OP_UNLIKELY(op_start==NULL))return OP_EFAULT;
*&oy_start=_of->oy;
*&os_start=_of->os;
prev_page_offset=_of->prev_page_offset;
......@@ -1669,6 +1669,7 @@ static int op_open1(OggOpusFile *_of,
/*Don't seek yet.
Set up a 'single' (current) logical bitstream entry for partial open.*/
_of->links=(OggOpusLink *)_ogg_malloc(sizeof(*_of->links));
if(OP_UNLIKELY(_of->links==NULL))return OP_EFAULT;
/*The serialno gets filled in later by op_fetch_headers().*/
ogg_stream_init(&_of->os,-1);
pog=NULL;
......@@ -2902,7 +2903,7 @@ static int op_ensure_buffer(OggOpusFile *_of,int _duration,int _nchannels){
if(capacity>_of->od_buffer_capacity){
op_sample *new_buffer;
new_buffer=(op_sample *)_ogg_realloc(_of->od_buffer,capacity);
if(new_buffer==NULL)return OP_EFAULT;
if(OP_UNLIKELY(new_buffer==NULL))return OP_EFAULT;
_of->od_buffer=new_buffer;
_of->od_buffer_capacity=capacity;
}
......
Supports Markdown
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