From b3e157882801d7a6a78f4d6674f1a798c079cee7 Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 26 Jun 2009 15:22:15 +0000 Subject: Use a single err_out in fb_preinit, also fixes a leak when vo_dbpp has an unexpected value. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29397 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_fbdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c index 11b16d7a02..eb7ad56ef6 100644 --- a/libvo/vo_fbdev.c +++ b/libvo/vo_fbdev.c @@ -673,6 +673,8 @@ static int fb_preinit(int reset) if (fb_preinit_done) return fb_works; + fb_dev_fd = fb_tty_fd = -1; + if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = strdup("/dev/fb0"); mp_msg(MSGT_VO, MSGL_V, "using %s\n", fb_dev_name); @@ -683,7 +685,7 @@ static int fb_preinit(int reset) } if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) { mp_msg(MSGT_VO, MSGL_ERR, "Can't get VSCREENINFO: %s\n", strerror(errno)); - goto err_out_fd; + goto err_out; } fb_orig_vinfo = fb_vinfo; @@ -696,13 +698,13 @@ static int fb_preinit(int reset) if (fb_bpp == 8 && !vo_dbpp) { mp_msg(MSGT_VO, MSGL_ERR, "8 bpp output is not supported.\n"); - goto err_out_tty_fd; + goto err_out; } if (vo_dbpp) { if (vo_dbpp != 15 && vo_dbpp != 16 && vo_dbpp != 24 && vo_dbpp != 32) { mp_msg(MSGT_VO, MSGL_ERR, "can't switch to %d bpp\n", vo_dbpp); - goto err_out_fd; + goto err_out; } fb_bpp = vo_dbpp; } @@ -713,13 +715,13 @@ static int fb_preinit(int reset) fb_preinit_done = 1; fb_works = 1; return 1; -err_out_tty_fd: +err_out: + if (fb_tty_fd != -1) close(fb_tty_fd); fb_tty_fd = -1; -err_out_fd: + if (fb_dev_fd != -1) close(fb_dev_fd); fb_dev_fd = -1; -err_out: fb_preinit_done = 1; fb_works = 0; return 0; -- cgit v1.2.3