summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-06-26 15:22:15 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-06-26 15:22:15 +0000
commitb3e157882801d7a6a78f4d6674f1a798c079cee7 (patch)
treea9922200e8b7fa7905cd5a5b023f44b27e95b2fc
parente56dbbfd3ca602169f38669a48c554a46c1202a0 (diff)
downloadmpv-b3e157882801d7a6a78f4d6674f1a798c079cee7.tar.bz2
mpv-b3e157882801d7a6a78f4d6674f1a798c079cee7.tar.xz
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
-rw-r--r--libvo/vo_fbdev.c14
1 files 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;