diff options
-rw-r--r-- | asxparser.c | 14 | ||||
-rw-r--r-- | codec-cfg.c | 18 | ||||
-rw-r--r-- | command.c | 6 | ||||
-rw-r--r-- | libvo/font_load.c | 12 | ||||
-rw-r--r-- | libvo/font_load_ft.c | 26 | ||||
-rw-r--r-- | m_config.c | 2 | ||||
-rw-r--r-- | m_option.c | 11 | ||||
-rw-r--r-- | mplayer.c | 7 | ||||
-rw-r--r-- | playtree.c | 6 | ||||
-rw-r--r-- | playtreeparser.c | 24 | ||||
-rw-r--r-- | spudec.c | 6 | ||||
-rw-r--r-- | stream/asf_streaming.c | 6 | ||||
-rw-r--r-- | stream/audio_in.c | 4 | ||||
-rw-r--r-- | stream/cdinfo.c | 8 | ||||
-rw-r--r-- | stream/http.c | 19 | ||||
-rw-r--r-- | stream/network.c | 18 | ||||
-rw-r--r-- | stream/stream.c | 4 | ||||
-rw-r--r-- | stream/stream_cddb.c | 4 | ||||
-rw-r--r-- | stream/stream_dvb.c | 20 | ||||
-rw-r--r-- | stream/stream_ftp.c | 2 | ||||
-rw-r--r-- | stream/stream_netstream.c | 3 | ||||
-rw-r--r-- | stream/stream_pvr.c | 22 | ||||
-rw-r--r-- | stream/stream_radio.c | 6 | ||||
-rw-r--r-- | stream/tv.c | 12 | ||||
-rw-r--r-- | stream/tvi_dshow.c | 20 | ||||
-rw-r--r-- | stream/tvi_v4l.c | 24 | ||||
-rw-r--r-- | stream/tvi_v4l2.c | 15 | ||||
-rw-r--r-- | stream/url.c | 18 | ||||
-rw-r--r-- | sub_cc.c | 7 | ||||
-rw-r--r-- | subopt-helper.c | 3 | ||||
-rw-r--r-- | subreader.c | 4 | ||||
-rw-r--r-- | vobsub.c | 18 |
32 files changed, 146 insertions, 223 deletions
diff --git a/asxparser.c b/asxparser.c index 56820a0e7f..9ad0935726 100644 --- a/asxparser.c +++ b/asxparser.c @@ -88,7 +88,7 @@ asx_parser_new(struct m_config *mconfig) void asx_parser_free(ASX_Parser_t* parser) { if(!parser) return; - if(parser->ret_stack) free(parser->ret_stack); + free(parser->ret_stack); free(parser); } @@ -290,7 +290,7 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer, if(*ptr3 == '\0') { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"At line %d : EOB reached while parsing %s element body",parser->line,element); free(element); - if(attribs) free(attribs); + free(attribs); return -1; } if(ptr3[0] == '\n') parser->line++; @@ -318,7 +318,7 @@ asx_get_element(ASX_Parser_t* parser,char** _buffer, if(ptr4 == NULL || ptr4[1] == '\0') { mp_msg(MSGT_PLAYTREE,MSGL_ERR,"At line %d : EOB reached while parsing %s element body",parser->line,element); free(element); - if(attribs) free(attribs); + free(attribs); return -1; } if(ptr4[1] != '/' && strncasecmp(element,ptr4+1,strlen(element)) == 0) { @@ -407,7 +407,7 @@ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) { } play_tree_set_param(pt,name,val); free(name); - if(val) free(val); + free(val); } static void @@ -499,7 +499,7 @@ asx_parse_entry(ASX_Parser_t* parser,char* buffer,char** _attribs) { nref++; } else mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Ignoring element %s\n",element); - if(body) free(body); + free(body); asx_free_attribs(attribs); } @@ -565,7 +565,7 @@ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) { asx_parse_param(parser,attribs,repeat); } else mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Ignoring element %s\n",element); - if(body) free(body); + free(body); asx_free_attribs(attribs); } @@ -650,7 +650,7 @@ asx_parser_build_tree(struct m_config *mconfig, char* buffer,int deep) { } } else mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Ignoring element %s\n",element); - if(body) free(body); + free(body); asx_free_attribs(attribs); } diff --git a/codec-cfg.c b/codec-cfg.c index ced013386a..84402ada7b 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -782,19 +782,13 @@ static void codecs_free(codecs_t* codecs,int count) { int i; for ( i = 0; i < count; i++) if ( codecs[i].name ) { - if( codecs[i].name ) - free(codecs[i].name); - if( codecs[i].info ) - free(codecs[i].info); - if( codecs[i].comment ) - free(codecs[i].comment); - if( codecs[i].dll ) - free(codecs[i].dll); - if( codecs[i].drv ) - free(codecs[i].drv); + free(codecs[i].name); + free(codecs[i].info); + free(codecs[i].comment); + free(codecs[i].dll); + free(codecs[i].drv); } - if (codecs) - free(codecs); + free(codecs); } void codecs_uninit_free(void) { @@ -517,8 +517,7 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg, else set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration, "Chapter: (%d) %s", 0, mp_gtext("unknown")); - if (chapter_name) - talloc_free(chapter_name); + talloc_free(chapter_name); return M_PROPERTY_OK; } @@ -601,8 +600,7 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg, set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration, "Angle: %d/%d", angle, angles); - if (angle_name) - free(angle_name); + free(angle_name); return M_PROPERTY_OK; } diff --git a/libvo/font_load.c b/libvo/font_load.c index e7d36d8a2c..e9980b8e41 100644 --- a/libvo/font_load.c +++ b/libvo/font_load.c @@ -169,8 +169,7 @@ while(fgets(sor,1020,f)){ if(strcmp(section,"[fpath]")==0){ if(pdb==1){ - if (desc->fpath) - free (desc->fpath); // release previously allocated memory + free (desc->fpath); // release previously allocated memory desc->fpath=strdup(p[0]); continue; } @@ -345,12 +344,9 @@ return desc; fail_out: if (f) fclose(f); - if (desc->fpath) - free(desc->fpath); - if (desc->name) - free(desc->name); - if (desc) - free(desc); + free(desc->fpath); + free(desc->name); + free(desc); return NULL; } diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c index 3ba90bd5da..3c1ff55d19 100644 --- a/libvo/font_load_ft.c +++ b/libvo/font_load_ft.c @@ -859,27 +859,27 @@ void free_font_desc(font_desc_t *desc) // if (!desc->dynamic) return; // some vo_aa crap, better leaking than crashing - if (desc->name) free(desc->name); - if (desc->fpath) free(desc->fpath); + free(desc->name); + free(desc->fpath); for(i = 0; i < 16; i++) { if (desc->pic_a[i]) { - if (desc->pic_a[i]->bmp) free(desc->pic_a[i]->bmp); - if (desc->pic_a[i]->pal) free(desc->pic_a[i]->pal); - free (desc->pic_a[i]); + free(desc->pic_a[i]->bmp); + free(desc->pic_a[i]->pal); + free(desc->pic_a[i]); } if (desc->pic_b[i]) { - if (desc->pic_b[i]->bmp) free(desc->pic_b[i]->bmp); - if (desc->pic_b[i]->pal) free(desc->pic_b[i]->pal); - free (desc->pic_b[i]); + free(desc->pic_b[i]->bmp); + free(desc->pic_b[i]->pal); + free(desc->pic_b[i]); } } - if (desc->tables.g) free(desc->tables.g); - if (desc->tables.gt2) free(desc->tables.gt2); - if (desc->tables.om) free(desc->tables.om); - if (desc->tables.omt) free(desc->tables.omt); - if (desc->tables.tmp) free(desc->tables.tmp); + free(desc->tables.g); + free(desc->tables.gt2); + free(desc->tables.om); + free(desc->tables.omt); + free(desc->tables.tmp); for(i = 0; i < desc->face_cnt; i++) { FT_Done_Face(desc->faces[i]); diff --git a/m_config.c b/m_config.c index b46bca94ad..204115f1db 100644 --- a/m_config.c +++ b/m_config.c @@ -465,7 +465,7 @@ m_config_parse_option(const m_config_t *config, char *arg, char *param, int set) free(lst[2*i]); free(lst[2*i+1]); } - if(lst) free(lst); + free(lst); } else r = m_option_parse(co->opt,arg,param,set ? co->slots->data : NULL,config->mode); diff --git a/m_option.c b/m_option.c index 6e814bf8b5..daab955614 100644 --- a/m_option.c +++ b/m_option.c @@ -446,8 +446,7 @@ static int parse_str(const m_option_t* opt,const char *name, const char *param, } if(dst) { - if(VAL(dst)) - free(VAL(dst)); + free(VAL(dst)); VAL(dst) = strdup(param); } @@ -462,7 +461,7 @@ static char* print_str(const m_option_t* opt, const void* val) { static void copy_str(const m_option_t* opt,void* dst, const void* src) { if(dst && src) { #ifndef NO_FREE - if(VAL(dst)) free(VAL(dst)); //FIXME!!! + free(VAL(dst)); //FIXME!!! #endif VAL(dst) = VAL(src) ? strdup(VAL(src)) : NULL; } @@ -577,7 +576,7 @@ static int str_list_del(char** del, int n,void* dst) { free(del); if(s == 0) { - if(lst) free(lst); + free(lst); VAL(dst) = NULL; return 1; } @@ -590,7 +589,7 @@ static int str_list_del(char** del, int n,void* dst) { } d[s] = NULL; - if(lst) free(lst); + free(lst); VAL(dst) = d; return 1; @@ -783,7 +782,7 @@ static void free_func_pf(void* src) { while(s) { n = s->next; free(s->name); - if(s->param) free(s->param); + free(s->param); free(s); s = n; } @@ -655,7 +655,7 @@ int volstep = 3; static void mp_dvdnav_context_free(MPContext *ctx){ if (ctx->nav_smpi) free_mp_image(ctx->nav_smpi); ctx->nav_smpi = NULL; - if (ctx->nav_buffer) free(ctx->nav_buffer); + free(ctx->nav_buffer); ctx->nav_buffer = NULL; ctx->nav_start = NULL; ctx->nav_in_size = 0; @@ -814,7 +814,7 @@ void exit_player_with_rc(struct MPContext *mpctx, enum exit_reason how, int rc) talloc_free(mpctx->key_fifo); - if(edl_records != NULL) free(edl_records); // free mem allocated for EDL + free(edl_records); // free mem allocated for EDL edl_records = NULL; switch(how) { case EXIT_QUIT: @@ -2108,8 +2108,7 @@ static void mp_dvdnav_save_smpi(struct MPContext *mpctx, int in_size, if (mpctx->stream->type != STREAMTYPE_DVDNAV) return; - if (mpctx->nav_buffer) - free(mpctx->nav_buffer); + free(mpctx->nav_buffer); mpctx->nav_buffer = malloc(in_size); mpctx->nav_start = start; diff --git a/playtree.c b/playtree.c index 42762064c2..d9b29e874a 100644 --- a/playtree.c +++ b/playtree.c @@ -68,7 +68,7 @@ play_tree_free(play_tree_t* pt, int children) { for(iter = pt->child ; iter != NULL ; iter = iter->next) iter->parent = NULL; - //if(pt->params) free(pt->params); + //free(pt->params); if(pt->files) { int i; for(i = 0 ; pt->files[i] != NULL ; i++) @@ -384,8 +384,8 @@ play_tree_unset_param(play_tree_t* pt, char* name) { if(ni < 0) return 0; - if(pt->params[ni].name) free(pt->params[ni].name); - if(pt->params[ni].value) free(pt->params[ni].value); + free(pt->params[ni].name); + free(pt->params[ni].value); if(n > 1) { memmove(&pt->params[ni],&pt->params[ni+1],(n-ni)*sizeof(play_tree_param_t)); diff --git a/playtreeparser.c b/playtreeparser.c index 93a8dfefc0..29530ae161 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -355,14 +355,9 @@ parse_pls(play_tree_parser_t* p) { list = entry; last_entry = entry; } - if(entries[num].title) { - // When we have info in playtree we add this info - free(entries[num].title); - } - if(entries[num].length) { - // When we have info in playtree we add this info - free(entries[num].length); - } + // When we have info in playtree we add these info + free(entries[num].title); + free(entries[num].length); } free(entries); @@ -518,10 +513,8 @@ parse_smil(play_tree_parser_t* p) { line = NULL; do { strstrip(src_line); - if (line) { - free(line); - line = NULL; - } + free(line); + line = NULL; /* If we're parsing smil over realrtsp and this is not the last packet and * this is the last line in the packet (terminating with ") ) we must get * the next line, strip the header, and concatenate it to the current line. @@ -601,8 +594,7 @@ parse_smil(play_tree_parser_t* p) { } } while((src_line = play_tree_parser_get_line(p)) != NULL); - if (line) - free(line); + free(line); if(!list) return NULL; // Nothing found @@ -811,8 +803,8 @@ play_tree_parser_free(play_tree_parser_t* p) { assert(p != NULL); #endif - if(p->buffer) free(p->buffer); - if(p->line) free(p->line); + free(p->buffer); + free(p->line); free(p); } @@ -146,8 +146,7 @@ static packet_t *spudec_dequeue_packet(spudec_handle_t *this) static void spudec_free_packet(packet_t *packet) { - if (packet->packet != NULL) - free(packet->packet); + free(packet->packet); free(packet); } @@ -609,8 +608,7 @@ void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pt unsigned int len2 = get_be16(packet); // Start new fragment if (spu->packet_reserve < len2) { - if (spu->packet != NULL) - free(spu->packet); + free(spu->packet); spu->packet = malloc(len2); spu->packet_reserve = spu->packet != NULL ? len2 : 0; } diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index c50d373cab..891f519d28 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -401,9 +401,9 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl) len_err_out: mp_tmsg(MSGT_NETWORK, MSGL_FATAL, "Invalid length in ASF header!\n"); - if (buffer) free(buffer); - if (v_rates) free(v_rates); - if (a_rates) free(a_rates); + free(buffer); + free(v_rates); + free(a_rates); return -1; } diff --git a/stream/audio_in.c b/stream/audio_in.c index 67a345b907..b7d388d89d 100644 --- a/stream/audio_in.c +++ b/stream/audio_in.c @@ -132,7 +132,7 @@ int audio_in_set_device(audio_in_t *ai, char *device) switch (ai->type) { #ifdef CONFIG_ALSA case AUDIO_IN_ALSA: - if (ai->alsa.device) free(ai->alsa.device); + free(ai->alsa.device); ai->alsa.device = strdup(device); /* mplayer cannot handle colons in arguments */ for (i = 0; i < (int)strlen(ai->alsa.device); i++) { @@ -142,7 +142,7 @@ int audio_in_set_device(audio_in_t *ai, char *device) #endif #ifdef CONFIG_OSS_AUDIO case AUDIO_IN_OSS: - if (ai->oss.device) free(ai->oss.device); + free(ai->oss.device); ai->oss.device = strdup(device); return 0; #endif diff --git a/stream/cdinfo.c b/stream/cdinfo.c index cc42bf11e4..3ec5560a24 100644 --- a/stream/cdinfo.c +++ b/stream/cdinfo.c @@ -53,15 +53,15 @@ void cd_info_free(cd_info_t *cd_info) { cd_track_t *cd_track, *cd_track_next; if( cd_info==NULL ) return; - if( cd_info->artist!=NULL ) free(cd_info->artist); - if( cd_info->album!=NULL ) free(cd_info->album); - if( cd_info->genre!=NULL ) free(cd_info->genre); + free(cd_info->artist); + free(cd_info->album); + free(cd_info->genre); cd_track_next = cd_info->first; while( cd_track_next!=NULL ) { cd_track = cd_track_next; cd_track_next = cd_track->next; - if( cd_track->name!=NULL ) free(cd_track->name); + free(cd_track->name); free(cd_track); } } diff --git a/stream/http.c b/stream/http.c index 0c8bb33f56..e6b0909996 100644 --- a/stream/http.c +++ b/stream/http.c @@ -309,17 +309,16 @@ void http_free( HTTP_header_t *http_hdr ) { HTTP_field_t *field, *field2free; if( http_hdr==NULL ) return; - if( http_hdr->protocol!=NULL ) free( http_hdr->protocol ); - if( http_hdr->uri!=NULL ) free( http_hdr->uri ); - if( http_hdr->reason_phrase!=NULL ) free( http_hdr->reason_phrase ); - if( http_hdr->field_search!=NULL ) free( http_hdr->field_search ); - if( http_hdr->method!=NULL ) free( http_hdr->method ); - if( http_hdr->buffer!=NULL ) free( http_hdr->buffer ); + free(http_hdr->protocol); + free(http_hdr->uri); + free(http_hdr->reason_phrase); + free(http_hdr->field_search); + free(http_hdr->method); + free(http_hdr->buffer); field = http_hdr->first_field; while( field!=NULL ) { field2free = field; - if (field->field_name) - free(field->field_name); + free(field->field_name); field = field->next; free( field2free ); } @@ -442,7 +441,7 @@ http_response_parse( HTTP_header_t *http_hdr ) { hdr_ptr = ptr+((*ptr=='\r')?2:1); } while( hdr_ptr<(http_hdr->buffer+pos_hdr_sep) ); - if( field!=NULL ) free( field ); + free(field); if( pos_hdr_sep+hdr_sep_len<http_hdr->buffer_size ) { // Response has data! @@ -515,7 +514,7 @@ http_build_request( HTTP_header_t *http_hdr ) { memcpy( ptr, http_hdr->body, http_hdr->body_size ); } - if( uri ) free( uri ); + free(uri); return http_hdr->buffer; } diff --git a/stream/network.c b/stream/network.c index cbf643a6f2..d614774a96 100644 --- a/stream/network.c +++ b/stream/network.c @@ -128,9 +128,9 @@ void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl ) { if( streaming_ctrl==NULL ) return; if( streaming_ctrl->url ) url_free( streaming_ctrl->url ); - if( streaming_ctrl->buffer ) free( streaming_ctrl->buffer ); - if( streaming_ctrl->data ) free( streaming_ctrl->data ); - free( streaming_ctrl ); + free(streaming_ctrl->buffer); + free(streaming_ctrl->data); + free(streaming_ctrl); } URL_t* @@ -338,14 +338,10 @@ http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) { return -1; } if( *auth_retry>0 ) { - if( url->username ) { - free( url->username ); - url->username = NULL; - } - if( url->password ) { - free( url->password ); - url->password = NULL; - } + free(url->username); + url->username = NULL; + free(url->password); + url->password = NULL; } aut = http_get_field(http_hdr, "WWW-Authenticate"); diff --git a/stream/stream.c b/stream/stream.c index 041b3a8c67..6f35252e3d 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -512,8 +512,8 @@ void free_stream(stream_t *s){ #endif // Disabled atm, i don't like that. s->priv can be anything after all // streams should destroy their priv on close - //if(s->priv) free(s->priv); - if(s->url) free(s->url); + //free(s->priv); + free(s->url); free(s); } diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index abc6a86966..5a4b3c1cee 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -783,9 +783,7 @@ static int cddb_retrieve(cddb_data_t *cddb_data) if (ret < 0) return -1; - if (cddb_data->cache_dir != NULL) { - free(cddb_data->cache_dir); - } + free(cddb_data->cache_dir); return 0; } diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index ed8c1b81ec..13f32c29a8 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -402,8 +402,7 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type) fclose(f); if(list->NUM_CHANNELS == 0) { - if(list->channels != NULL) - free(list->channels); + free(list->channels); free(list); return NULL; } @@ -418,17 +417,13 @@ void dvb_free_config(dvb_config_t *config) for(i=0; i<config->count; i++) { - if(config->cards[i].name) - free(config->cards[i].name); + free(config->cards[i].name); if(!config->cards[i].list) continue; if(config->cards[i].list->channels) { for(j=0; j<config->cards[i].list->NUM_CHANNELS; j++) - { - if(config->cards[i].list->channels[j].name) - free(config->cards[i].list->channels[j].name); - } + free(config->cards[i].list->channels[j].name); free(config->cards[i].list->channels); } free(config->cards[i].list); @@ -801,20 +796,17 @@ dvb_config_t *dvb_get_config(void) if((access(conf_file, F_OK | R_OK) != 0)) { - if(conf_file) - free(conf_file); + free(conf_file); conf_file = get_path("channels.conf"); if((access(conf_file, F_OK | R_OK) != 0)) { - if(conf_file) - free(conf_file); + free(conf_file); conf_file = strdup(MPLAYER_CONFDIR "/channels.conf"); } } list = dvb_get_channels(conf_file, type); - if(conf_file) - free(conf_file); + free(conf_file); if(list == NULL) continue; diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c index 69dc326641..00027d5205 100644 --- a/stream/stream_ftp.c +++ b/stream/stream_ftp.c @@ -377,7 +377,7 @@ static void close_f(stream_t *s) { FtpSendCmd("QUIT",p,NULL); if(p->handle) closesocket(p->handle); - if(p->buf) free(p->buf); + free(p->buf); m_struct_free(&stream_opts,p); } diff --git a/stream/stream_netstream.c b/stream/stream_netstream.c index ba1bb01ee7..6240aa7044 100644 --- a/stream/stream_netstream.c +++ b/stream/stream_netstream.c @@ -223,8 +223,7 @@ static void close_s(struct stream *s) { mp_net_stream_packet_t* pack; pack = send_net_stream_cmd(s,NET_STREAM_CLOSE,NULL,0); - if(pack) - free(pack); + free(pack); } static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { diff --git a/stream/stream_pvr.c b/stream/stream_pvr.c index 3271ce9742..4048168990 100644 --- a/stream/stream_pvr.c +++ b/stream/stream_pvr.c @@ -187,15 +187,9 @@ pvr_uninit (struct pvr_t *pvr) if (pvr->dev_fd) close (pvr->dev_fd); - if (pvr->video_dev) - free (pvr->video_dev); - - if (pvr->stationlist.list) - free (pvr->stationlist.list); - - if (pvr->param_channel) - free (pvr->param_channel); - + free (pvr->video_dev); + free (pvr->stationlist.list); + free (pvr->param_channel); free (pvr); } @@ -214,11 +208,8 @@ copycreate_stationlist (stationlist_t *stationlist, int num) num = FFMAX (num, chanlists[chantab].count); - if (stationlist->list) - { - free (stationlist->list); - stationlist->list = NULL; - } + free (stationlist->list); + stationlist->list = NULL; stationlist->total = 0; stationlist->enabled = 0; @@ -1150,8 +1141,7 @@ parse_v4l2_tv_options (struct pvr_t *pvr) if (stream_tv_defaults.device) { - if (pvr->video_dev) - free (pvr->video_dev); + free (pvr->video_dev); pvr->video_dev = strdup (stream_tv_defaults.device); } diff --git a/stream/stream_radio.c b/stream/stream_radio.c index bfa0f18d0b..f7612f0085 100644 --- a/stream/stream_radio.c +++ b/stream/stream_radio.c @@ -1224,10 +1224,8 @@ static void close_s(struct stream *stream){ if (!priv) return; #ifdef CONFIG_RADIO_CAPTURE - if(priv->audio_ringbuffer){ - free(priv->audio_ringbuffer); - priv->audio_ringbuffer=NULL; - } + free(priv->audio_ringbuffer); + priv->audio_ringbuffer = NULL; priv->do_capture=0; #endif diff --git a/stream/tv.c b/stream/tv.c index daa6b7dd7f..925109e778 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -107,13 +107,11 @@ tvi_handle_t *tv_new_handle(int size, const tvi_functions_t *functions) void tv_free_handle(tvi_handle_t *h) { - if (h) { - if (h->priv) - free(h->priv); - if (h->scan) - free(h->scan); - free(h); - } + if (!h) + return; + free(h->priv); + free(h->scan); + free(h); } void tv_start_scan(tvi_handle_t *tvh, int start) diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c index 9394176719..3b4535ac8c 100644 --- a/stream/tvi_dshow.c +++ b/stream/tvi_dshow.c @@ -747,15 +747,12 @@ static void destroy_ringbuffer(grabber_ringbuffer_t * rb) if (rb->ringbuffer) { for (i = 0; i < rb->buffersize; i++) - if (rb->ringbuffer[i]) - free(rb->ringbuffer[i]); + free(rb->ringbuffer[i]); free(rb->ringbuffer); rb->ringbuffer = NULL; } - if (rb->dpts) { - free(rb->dpts); - rb->dpts = NULL; - } + free(rb->dpts); + rb->dpts = NULL; if (rb->pMutex) { DeleteCriticalSection(rb->pMutex); free(rb->pMutex); @@ -2090,15 +2087,13 @@ static HRESULT get_available_formats_stream(chain_t *chain) } if (!done) { for (i = 0; i < count; i++) { - if (pBuf && pBuf[i]) + if (pBuf) free(pBuf[i]); if (arpmt && arpmt[i]) DeleteMediaType(arpmt[i]); } - if (pBuf) - free(pBuf); - if (arpmt) - free(arpmt); + free(pBuf); + free(arpmt); if (hr != S_OK) { mp_msg(MSGT_TV, MSGL_DBG4, "tvi_dshow: Call to GetStreamCaps failed (get_available_formats_stream)\n"); return hr; @@ -2220,8 +2215,7 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder, for (i = 0; i < count; i++) { if (arpmt[i]) DeleteMediaType(arpmt[i]); - if (pBuf[i]) - free(pBuf[i]); + free(pBuf[i]); } free(arpmt); free(pBuf); diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c index d380a3684e..bbf290eeaf 100644 --- a/stream/tvi_v4l.c +++ b/stream/tvi_v4l.c @@ -676,10 +676,8 @@ static int init(priv_t *priv) return 1; malloc_failed: - if (priv->channels) - free(priv->channels); - if (priv->buf) - free(priv->buf); + free(priv->channels); + free(priv->buf); err: if (priv->video_fd != -1) close(priv->video_fd); @@ -702,10 +700,8 @@ static int uninit(priv_t *priv) priv->vbi_fd=0; } |