diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-01-30 15:41:45 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-01-30 15:41:45 +0000 |
commit | 57ff94b5cdf869298672728b3c5ed8932202ce98 (patch) | |
tree | a31816bd7a4be6953eab0b6c6c24904ff768873e | |
parent | 3de8ddabc73aa9f96def1809113eb79efcec17e4 (diff) | |
download | mpv-57ff94b5cdf869298672728b3c5ed8932202ce98.tar.bz2 mpv-57ff94b5cdf869298672728b3c5ed8932202ce98.tar.xz |
Move setting of O_NONBLOCK before lirc_readconfig, this avoids a memleak
due to not freeing the lirc config on error.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28390 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | input/lirc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/input/lirc.c b/input/lirc.c index 17b7364e9e..4e60f01182 100644 --- a/input/lirc.c +++ b/input/lirc.c @@ -46,13 +46,6 @@ mp_input_lirc_init(void) { return -1; } - if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){ - mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr, - lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile); - lirc_deinit(); - return -1; - } - mode = fcntl(lirc_sock, F_GETFL); if (mode < 0 || fcntl(lirc_sock, F_SETFL, mode | O_NONBLOCK) < 0) { mp_msg(MSGT_LIRC, MSGL_ERR, "setting non-blocking mode failed: %s\n", @@ -61,6 +54,13 @@ mp_input_lirc_init(void) { return -1; } + if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){ + mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr, + lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile); + lirc_deinit(); + return -1; + } + return lirc_sock; } |