ref: 68f18feb28bcf5be1f7ae3610851e8b52105b36a
parent: 6587f1de894c86b4655c3da0802635caf9f07eaf
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Sat Jul 13 09:41:23 EDT 2013
Plug possible memory leak on stream open failure. Not all the failure paths cleaned up after themselves properly. Thanks to tangobravo for complaining about similar issues in libvorbisfile, which prompted me to audit this code.
--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -1527,12 +1527,7 @@
if(!seekable)_of->cur_link++;
pog=&og;
}
- if(OP_UNLIKELY(ret<0)){
- /*Don't auto-close the stream on failure.*/
- _of->callbacks.close=NULL;
- op_clear(_of);
- }
- else _of->ready_state=OP_PARTOPEN;
+ if(OP_LIKELY(ret>=0))_of->ready_state=OP_PARTOPEN;
return ret;
}
@@ -1569,6 +1564,9 @@
if(_error!=NULL)*_error=0;
return of;
}
+ /*Don't auto-close the stream on failure.*/
+ of->callbacks.close=NULL;
+ op_clear(of);
_ogg_free(of);
}
if(_error!=NULL)*_error=ret;