summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2011-08-25 19:39:01 +0000
committerThomas Jarosch <tomj@simonv.com>2011-08-25 19:39:01 +0000
commit12ac3814081f9a5e97f92247536b7251ea59b62b (patch)
treeb9520a142740ca2d92e6bc7bc2279e9cc57ae800 /apps/playlist.c
parentbc6dd127e32f61599f5becb264095f70757ae216 (diff)
downloadrockbox-12ac3814081f9a5e97f92247536b7251ea59b62b.tar.gz
rockbox-12ac3814081f9a5e97f92247536b7251ea59b62b.tar.bz2
rockbox-12ac3814081f9a5e97f92247536b7251ea59b62b.zip
Fix file descriptor leak on error
Credit goes to "cppcheck". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30349 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 8334260242..3d3b5f44f8 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -418,10 +418,13 @@ static int recreate_control(struct playlist_info* playlist)
playlist->control_fd = open(playlist->control_filename,
O_CREAT|O_RDWR|O_TRUNC, 0666);
if (playlist->control_fd < 0)
+ {
+ close(temp_fd);
return -1;
+ }
playlist->filename[playlist->dirlen-1] = '\0';
-
+
/* cannot call update_control() because of mutex */
result = fdprintf(playlist->control_fd, "P:%d:%s:%s\n",
PLAYLIST_CONTROL_FILE_VERSION, dir, file);