comparison libmpdemux/demux_ogg.c @ 32537:8fa2f43cb760

Remove most of the NULL pointer check before free all over the code
author cboesch
date Sun, 14 Nov 2010 09:12:34 +0000
parents fbe5c829c69b
children 55ff5df09657
comparison
equal deleted inserted replaced
32536:187f26cba0ce 32537:8fa2f43cb760
435 index = demux_ogg_sub_reverse_id(d, id); 435 index = demux_ogg_sub_reverse_id(d, id);
436 if (index >= 0) { 436 if (index >= 0) {
437 sh_sub_t *sh; 437 sh_sub_t *sh;
438 438
439 // in case of malicious files with more than one lang per track: 439 // in case of malicious files with more than one lang per track:
440 if (ogg_d->text_langs[index]) 440 free(ogg_d->text_langs[index]);
441 free(ogg_d->text_langs[index]);
442 ogg_d->text_langs[index] = strdup(val); 441 ogg_d->text_langs[index] = strdup(val);
443 sh = d->s_streams[index]; 442 sh = d->s_streams[index];
444 if (sh && sh->lang) 443 if (sh)
445 free(sh->lang); 444 free(sh->lang);
446 if (sh) 445 if (sh)
447 sh->lang = strdup(val); 446 sh->lang = strdup(val);
448 } 447 }
449 // check for -slang if subs are uninitialized yet 448 // check for -slang if subs are uninitialized yet
1603 if (os->vi_initialized) 1602 if (os->vi_initialized)
1604 vorbis_info_clear(&os->vi); 1603 vorbis_info_clear(&os->vi);
1605 } 1604 }
1606 free(ogg_d->subs); 1605 free(ogg_d->subs);
1607 } 1606 }
1608 if (ogg_d->syncpoints) 1607 free(ogg_d->syncpoints);
1609 free(ogg_d->syncpoints); 1608 free(ogg_d->text_ids);
1610 if (ogg_d->text_ids)
1611 free(ogg_d->text_ids);
1612 if (ogg_d->text_langs) { 1609 if (ogg_d->text_langs) {
1613 for (i = 0; i < ogg_d->n_text; i++) 1610 for (i = 0; i < ogg_d->n_text; i++)
1614 if (ogg_d->text_langs[i]) free(ogg_d->text_langs[i]); 1611 free(ogg_d->text_langs[i]);
1615 free(ogg_d->text_langs); 1612 free(ogg_d->text_langs);
1616 } 1613 }
1617 free(ogg_d); 1614 free(ogg_d);
1618 } 1615 }
1619 1616