@@ -1107,19 +1107,26 @@ void print_header(ogg_page *og){
11071107 fprintf (stderr ,")\n\n" );
11081108}
11091109
1110- void copy_page (ogg_page * og ){
1110+ static int copy_page (ogg_page * og ){
11111111 unsigned char * temp = _ogg_malloc (og -> header_len );
1112+ if (!temp )
1113+ return -1 ;
11121114 memcpy (temp ,og -> header ,og -> header_len );
11131115 og -> header = temp ;
11141116
11151117 temp = _ogg_malloc (og -> body_len );
1118+ if (!temp )
1119+ return -1 ;
11161120 memcpy (temp ,og -> body ,og -> body_len );
11171121 og -> body = temp ;
1122+ return 0 ;
11181123}
11191124
1120- void free_page (ogg_page * og ){
1125+ static void free_page (ogg_page * og ){
11211126 _ogg_free (og -> header );
1127+ og -> header = NULL ;
11221128 _ogg_free (og -> body );
1129+ og -> body = NULL ;
11231130}
11241131
11251132void error (void ){
@@ -1502,6 +1509,11 @@ void test_pack(const int *pl, const int **headers, int byteskip,
15021509
15031510 int byteskipcount = 0 ;
15041511
1512+ if (!data ) {
1513+ fprintf (stderr ,"unable to allocate requried data buffer!\n" );
1514+ exit (1 );
1515+ }
1516+
15051517 ogg_stream_reset (& os_en );
15061518 ogg_stream_reset (& os_de );
15071519 ogg_sync_reset (& oy );
@@ -1813,6 +1825,11 @@ int main(void){
18131825 int inptr = 0 ,i ,j ;
18141826 ogg_page og [5 ];
18151827
1828+ if (!data ) {
1829+ fprintf (stderr ,"unable to allocate requried packet data buffer!\n" );
1830+ exit (1 );
1831+ }
1832+
18161833 ogg_stream_reset (& os_en );
18171834
18181835 for (i = 0 ;pl [i ]!= -1 ;i ++ ){
@@ -1836,7 +1853,10 @@ int main(void){
18361853 fprintf (stderr ,"Too few pages output building sync tests!\n" );
18371854 exit (1 );
18381855 }
1839- copy_page (& og [i ]);
1856+ if (-1 == copy_page (& og [i ])) {
1857+ fprintf (stderr ,"unable to copy page building sync tests!\n" );
1858+ exit (1 );
1859+ }
18401860 }
18411861
18421862 /* Test lost pages on pagein/packetout: no rollback */
0 commit comments