diff options
author | cboesch <cboesch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-11-14 09:12:34 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-14 13:11:20 +0200 |
commit | fe3c4810e1c8b535caf07df8e4434e322d3e6fc0 (patch) | |
tree | cbcd859f358c479223eb7b0aa2a2d3dfe1c81b69 /libvo | |
parent | b492561241f2a3263a8ab558fafc957130dbdfc1 (diff) | |
download | mpv-fe3c4810e1c8b535caf07df8e4434e322d3e6fc0.tar.bz2 mpv-fe3c4810e1c8b535caf07df8e4434e322d3e6fc0.tar.xz |
cleanup: remove NULL checks before free() all over the code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/gl_common.c | 3 | ||||
-rw-r--r-- | libvo/sub.c | 4 | ||||
-rw-r--r-- | libvo/video_out.c | 3 | ||||
-rw-r--r-- | libvo/vo_aa.c | 13 | ||||
-rw-r--r-- | libvo/vo_corevideo.m | 2 | ||||
-rw-r--r-- | libvo/vo_cvidix.c | 6 | ||||
-rw-r--r-- | libvo/vo_directx.c | 3 | ||||
-rw-r--r-- | libvo/vo_dxr2.c | 6 | ||||
-rw-r--r-- | libvo/vo_dxr3.c | 12 | ||||
-rw-r--r-- | libvo/vo_fbdev.c | 9 | ||||
-rw-r--r-- | libvo/vo_fbdev2.c | 4 | ||||
-rw-r--r-- | libvo/vo_ggi.c | 3 | ||||
-rw-r--r-- | libvo/vo_gif89a.c | 6 | ||||
-rw-r--r-- | libvo/vo_gl.c | 4 | ||||
-rw-r--r-- | libvo/vo_gl2.c | 9 | ||||
-rw-r--r-- | libvo/vo_jpeg.c | 12 | ||||
-rw-r--r-- | libvo/vo_md5sum.c | 6 | ||||
-rw-r--r-- | libvo/vo_pnm.c | 12 | ||||
-rw-r--r-- | libvo/vo_winvidix.c | 7 | ||||
-rw-r--r-- | libvo/vo_xvidix.c | 7 | ||||
-rw-r--r-- | libvo/vo_yuv4mpeg.c | 6 | ||||
-rw-r--r-- | libvo/vo_zr.c | 9 |
22 files changed, 52 insertions, 94 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 8d0036ef0d..ad6fc99a64 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1144,8 +1144,7 @@ static void create_conv_textures(gl_conversion_params_t *params, int *texu, char default: mp_msg(MSGT_VO, MSGL_ERR, "[gl] unknown conversion type %i\n", conv); } - if (lookup_data) - free(lookup_data); + free(lookup_data); } /** diff --git a/libvo/sub.c b/libvo/sub.c index 4df69c38ce..2c0f29d485 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -1084,8 +1084,8 @@ void osd_free(struct osd_state *osd) mp_osd_obj_t* obj=vo_osd_list; while(obj){ mp_osd_obj_t* next=obj->next; - if (obj->alpha_buffer) free(obj->alpha_buffer); - if (obj->bitmap_buffer) free(obj->bitmap_buffer); + free(obj->alpha_buffer); + free(obj->bitmap_buffer); free(obj); obj=next; } diff --git a/libvo/video_out.c b/libvo/video_out.c index 57e0444094..763527a4c1 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -643,8 +643,7 @@ range_t *str2range(char *s) r[i].min = r[i].max = -1; return r; out_err: - if (r) - free(r); + free(r); return NULL; } diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c index 0bcb424d99..3e55803982 100644 --- a/libvo/vo_aa.c +++ b/libvo/vo_aa.c @@ -651,17 +651,16 @@ static int parse_suboptions(const char *arg) { if (subcolor) aaopt_subcolor = getcolor(subcolor); } - if (subopts) free(subopts); - if (booleans) free(booleans); + free(subopts); + free(booleans); if (strings) { for (i=0; i<nstrings; i++) - if (strings[i]) - free(strings[i]); + free(strings[i]); free(strings); } - if (osdcolor) free(osdcolor); - if (subcolor) free(subcolor); - if (helpmsg) free(helpmsg); + free(osdcolor); + free(subcolor); + free(helpmsg); return retval; } diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 2a0f0ef7d2..585898a076 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -345,7 +345,7 @@ static void uninit(void) [finalPool release]; } - if (buffer_name) free(buffer_name); + free(buffer_name); buffer_name = NULL; } diff --git a/libvo/vo_cvidix.c b/libvo/vo_cvidix.c index 593ded5887..d0e6860c65 100644 --- a/libvo/vo_cvidix.c +++ b/libvo/vo_cvidix.c @@ -150,10 +150,8 @@ static int query_format(uint32_t format){ static void uninit(void){ if(!vo_config_count) return; vidix_term(); - if(vidix_name){ - free(vidix_name); - vidix_name = NULL; - } + free(vidix_name); + vidix_name = NULL; } static int preinit(const char *arg){ diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c index 9a940c6553..b80f0bdc01 100644 --- a/libvo/vo_directx.c +++ b/libvo/vo_directx.c @@ -1177,8 +1177,7 @@ static void flip_page(void) mp_msg(MSGT_VO,MSGL_WARN,"<vo_directx><WARN>stride changed !!!! disabling direct rendering\n"); vo_directrendering=0; } - if (tmp_image) - free(tmp_image); + free(tmp_image); tmp_image = NULL; dstride = ddsdsf.lPitch; image = ddsdsf.lpSurface; diff --git a/libvo/vo_dxr2.c b/libvo/vo_dxr2.c index 099446f635..00d5d2f3c0 100644 --- a/libvo/vo_dxr2.c +++ b/libvo/vo_dxr2.c @@ -790,10 +790,8 @@ static void uninit(void) close(dxr2_fd); dxr2_fd = -1; } - if(sub_img) { - free(sub_img); - sub_img = NULL; - } + free(sub_img); + sub_img = NULL; if(sub_vo) { int cc = vo_config_count; vo_config_count = sub_config_count; diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c index ab2318edd2..3494e25f00 100644 --- a/libvo/vo_dxr3.c +++ b/libvo/vo_dxr3.c @@ -692,12 +692,8 @@ static void uninit(void) close(fd_control); } #ifdef SPU_SUPPORT - if(osdpicbuf) { - free(osdpicbuf); - } - if(spued) { - free(spued); - } + free(osdpicbuf); + free(spued); #endif } @@ -912,9 +908,7 @@ static overlay_t *overlay_init(int dev) static int overlay_release(overlay_t *o) { - if(o) - free(o); - + free(o); return 0; } #define TYPE_INT 1 diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index 0bddd8dfce..991673a9cd 100644 --- a/libvo/vo_fbdev.c +++ b/libvo/vo_fbdev.c @@ -366,10 +366,8 @@ err_out_parse_error: err_out_print_linenum: mp_msg(MSGT_VO, MSGL_V, " at line %d\n", line_num); err_out: - if (fb_modes) { - free(fb_modes); - fb_modes = NULL; - } + free(fb_modes); + fb_modes = NULL; nr_modes = 0; free(line); free(fp); @@ -1121,8 +1119,7 @@ static int preinit(const char *vo_subdevice) else #endif { - if (fb_dev_name) - free(fb_dev_name); + free(fb_dev_name); fb_dev_name = strdup(vo_subdevice); } } diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c index 60bdee9a17..a4929afe13 100644 --- a/libvo/vo_fbdev2.c +++ b/libvo/vo_fbdev2.c @@ -220,7 +220,7 @@ static int preinit(const char *subdevice) { if (subdevice) { - if (fb_dev_name) free(fb_dev_name); + free(fb_dev_name); fb_dev_name = strdup(subdevice); } return fb_preinit(0); @@ -413,7 +413,7 @@ static void uninit(void) mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't restore original cmap\n"); fb_cmap_changed = 0; } - if(next_frame) free(next_frame); + free(next_frame); if (fb_dev_fd >= 0) { if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_orig_vinfo)) mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't reset original fb_var_screeninfo: %s\n", strerror(errno)); diff --git a/libvo/vo_ggi.c b/libvo/vo_ggi.c index 2be65696f5..b80e87ed3a 100644 --- a/libvo/vo_ggi.c +++ b/libvo/vo_ggi.c @@ -455,8 +455,7 @@ static int preinit(const char *arg) static void uninit(void) { - if (ggi_conf.driver) - free(ggi_conf.driver); + free(ggi_conf.driver); #ifdef CONFIG_GGIWMH ggiWmhDetach(ggi_conf.vis); diff --git a/libvo/vo_gif89a.c b/libvo/vo_gif89a.c index 3a1525f244..b808f8182b 100644 --- a/libvo/vo_gif89a.c +++ b/libvo/vo_gif89a.c @@ -362,9 +362,9 @@ static void uninit(void) } // free our allocated ram - if (gif_filename != NULL) free(gif_filename); - if (slice_data != NULL) free(slice_data); - if (reduce_data != NULL) free(reduce_data); + free(gif_filename); + free(slice_data); + free(reduce_data); if (reduce_cmap != NULL) FreeMapObject(reduce_cmap); // set the pointers back to null. diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index ea454c8f0e..8ffd82b6fd 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -1114,9 +1114,9 @@ static void uninit(void) { uninitGl(); - if (custom_prog) free(custom_prog); + free(custom_prog); custom_prog = NULL; - if (custom_tex) free(custom_tex); + free(custom_tex); custom_tex = NULL; uninit_mpglcontext(&glctx); } diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index f956fcf7d7..14137f76a6 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -236,8 +236,7 @@ static int initTextures(void) texpercx = (GLfloat) texture_width / (GLfloat) image_width; texpercy = (GLfloat) texture_height / (GLfloat) image_height; - if (texgrid) - free(texgrid); + free(texgrid); texgrid = calloc (texnumx * texnumy, sizeof (struct TexSquare)); raw_line_len = image_width * image_bytes; @@ -826,10 +825,8 @@ static void uninit(void) { if ( !vo_config_count ) return; - if (texgrid) { - free(texgrid); - texgrid = NULL; - } + free(texgrid); + texgrid = NULL; uninit_mpglcontext(&glctx); } diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index f27f2fd3fb..cafaf1f2d4 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -308,14 +308,10 @@ static int query_format(uint32_t format) static void uninit(void) { - if (jpeg_subdirs) { - free(jpeg_subdirs); - jpeg_subdirs = NULL; - } - if (jpeg_outdir) { - free(jpeg_outdir); - jpeg_outdir = NULL; - } + free(jpeg_subdirs); + jpeg_subdirs = NULL; + free(jpeg_outdir); + jpeg_outdir = NULL; } /* ------------------------------------------------------------------------- */ diff --git a/libvo/vo_md5sum.c b/libvo/vo_md5sum.c index bda2918396..0a2170bbd7 100644 --- a/libvo/vo_md5sum.c +++ b/libvo/vo_md5sum.c @@ -280,10 +280,8 @@ static int control(uint32_t request, void *data) static void uninit(void) { - if (md5sum_outfile) { - free(md5sum_outfile); - md5sum_outfile = NULL; - } + free(md5sum_outfile); + md5sum_outfile = NULL; if (md5sum_fd) fclose(md5sum_fd); } diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c index 195c7289b3..9593860412 100644 --- a/libvo/vo_pnm.c +++ b/libvo/vo_pnm.c @@ -556,14 +556,10 @@ static int control(uint32_t request, void *data) static void uninit(void) { - if (pnm_subdirs) { - free(pnm_subdirs); - pnm_subdirs = NULL; - } - if (pnm_outdir) { - free(pnm_outdir); - pnm_outdir = NULL; - } + free(pnm_subdirs); + pnm_subdirs = NULL; + free(pnm_outdir); + pnm_outdir = NULL; } /* ------------------------------------------------------------------------- */ diff --git a/libvo/vo_winvidix.c b/libvo/vo_winvidix.c index 7510bd0fd5..9655d95b4b 100644 --- a/libvo/vo_winvidix.c +++ b/libvo/vo_winvidix.c @@ -312,11 +312,8 @@ static void uninit(void){ if ( !vo_config_count ) return; vidix_term(); - if (vidix_name){ - free(vidix_name); - vidix_name = NULL; - } - // + free(vidix_name); + vidix_name = NULL; } static int preinit(const char *arg){ diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c index c6bcfcbab9..7741b9b6ff 100644 --- a/libvo/vo_xvidix.c +++ b/libvo/vo_xvidix.c @@ -362,11 +362,8 @@ static void uninit(void) return; vidix_term(); - if (vidix_name) - { - free(vidix_name); - vidix_name = NULL; - } + free(vidix_name); + vidix_name = NULL; vo_x11_uninit(); } diff --git a/libvo/vo_yuv4mpeg.c b/libvo/vo_yuv4mpeg.c index 8b9900d270..5901cce2c2 100644 --- a/libvo/vo_yuv4mpeg.c +++ b/libvo/vo_yuv4mpeg.c @@ -234,16 +234,14 @@ static int query_format(uint32_t format) // WARNING: config(...) also uses this static void uninit(void) { - if(image) - free(image); + free(image); image = NULL; if(yuv_out) fclose(yuv_out); yuv_out = NULL; - if (yuv_filename) - free(yuv_filename); + free(yuv_filename); yuv_filename = NULL; image_width = 0; image_height = 0; diff --git a/libvo/vo_zr.c b/libvo/vo_zr.c index 8ad201a877..4cb1ed0de6 100644 --- a/libvo/vo_zr.c +++ b/libvo/vo_zr.c @@ -265,10 +265,8 @@ int init_zoran(zr_info_t *zr, int stretchx, int stretchy) { } void uninit_zoran(zr_info_t *zr) { - if (zr->image) { - free(zr->image); - zr->image=NULL; - } + free(zr->image); + zr->image=NULL; while (zr->queue > zr->synco + 1) { if (ioctl(zr->vdes, MJPIOC_SYNC, &zr->zs) < 0) mp_msg(MSGT_VO, MSGL_ERR, "zr: error waiting for buffers to become free\n"); @@ -796,8 +794,7 @@ void vo_zr_revertoption(const m_option_t* opt,const char* param) { zr_parsing = 0; if (!strcasecmp(param, "zrdev")) { - if(zr->device) - free(zr->device); + free(zr->device); zr->device=NULL; } else if (!strcasecmp(param, "zrbw")) zr->bw=0; |