shithub: opus

Download patch

ref: 756c7595dc02a9eb97cc08255b56b31d4e9f64a5
parent: a9b864b80ab4ee1242c5601f84d93fa912d33075
author: Gregory Maxwell <[email protected]>
date: Sun Oct 9 14:08:06 EDT 2011

Make opus_repacketizer_create handle malloc failure gracefully.

--- a/src/repacketizer.c
+++ b/src/repacketizer.c
@@ -56,7 +56,10 @@
 
 OpusRepacketizer *opus_repacketizer_create(void)
 {
-   return opus_repacketizer_init((OpusRepacketizer *)opus_alloc(opus_repacketizer_get_size()));
+   OpusRepacketizer *rp;
+   rp=(OpusRepacketizer *)opus_alloc(opus_repacketizer_get_size());
+   if(rp==NULL)return NULL;
+   return opus_repacketizer_init(rp);
 }
 
 void opus_repacketizer_destroy(OpusRepacketizer *rp)