Don't overrun buffer on oom if assertions disabled
authorMark Harris <mark.hsj@gmail.com>
Thu, 13 Sep 2018 06:52:21 +0000 (23:52 -0700)
committerMark Harris <mark.hsj@gmail.com>
Thu, 13 Sep 2018 07:35:01 +0000 (00:35 -0700)
src/ogg_packer.c

index 01e7f6f..39d5534 100644 (file)
@@ -325,12 +325,9 @@ int oggp_flush_page(oggpacker *oggp) {
       /* Making sure we don't need to do that too often. */
       newsize = 1 + oggp->pages_size*3/2;
       newbuf = realloc(oggp->pages, newsize*sizeof(oggp_page));
-      if (newbuf != NULL) {
-        oggp->pages = newbuf;
-        oggp->pages_size = newsize;
-      } else {
-        assert(0);
-      }
+      assert(newbuf != NULL);
+      oggp->pages = newbuf;
+      oggp->pages_size = newsize;
     }
     p = &oggp->pages[oggp->pages_fill++];
     p->granulepos = oggp->curr_granule;