comparison sub/spudec.c @ 32511:b39155e98ac3

Remove some useless NULL pointer checks before invoking free() on the pointer. patch by From: Clment Bsch, ubitux gmail com
author diego
date Sun, 07 Nov 2010 12:47:40 +0000
parents fbe5c829c69b
children 1cad23803d94
comparison
equal deleted inserted replaced
32510:b756312f1d15 32511:b39155e98ac3
144 return retval; 144 return retval;
145 } 145 }
146 146
147 static void spudec_free_packet(packet_t *packet) 147 static void spudec_free_packet(packet_t *packet)
148 { 148 {
149 if (packet->packet != NULL) 149 free(packet->packet);
150 free(packet->packet);
151 free(packet); 150 free(packet);
152 } 151 }
153 152
154 static inline unsigned int get_be16(const unsigned char *p) 153 static inline unsigned int get_be16(const unsigned char *p)
155 { 154 {
607 spu->packet_pts = pts100; 606 spu->packet_pts = pts100;
608 if (spu->packet_offset == 0) { 607 if (spu->packet_offset == 0) {
609 unsigned int len2 = get_be16(packet); 608 unsigned int len2 = get_be16(packet);
610 // Start new fragment 609 // Start new fragment
611 if (spu->packet_reserve < len2) { 610 if (spu->packet_reserve < len2) {
612 if (spu->packet != NULL) 611 free(spu->packet);
613 free(spu->packet);
614 spu->packet = malloc(len2); 612 spu->packet = malloc(len2);
615 spu->packet_reserve = spu->packet != NULL ? len2 : 0; 613 spu->packet_reserve = spu->packet != NULL ? len2 : 0;
616 } 614 }
617 if (spu->packet != NULL) { 615 if (spu->packet != NULL) {
618 spu->packet_size = len2; 616 spu->packet_size = len2;