summaryrefslogtreecommitdiff
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
parentbc6dd127e32f61599f5becb264095f70757ae216 (diff)
downloadrockbox-12ac3814081f9a5e97f92247536b7251ea59b62b.tar.gz
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
-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)
418 playlist->control_fd = open(playlist->control_filename, 418 playlist->control_fd = open(playlist->control_filename,
419 O_CREAT|O_RDWR|O_TRUNC, 0666); 419 O_CREAT|O_RDWR|O_TRUNC, 0666);
420 if (playlist->control_fd < 0) 420 if (playlist->control_fd < 0)
421 {
422 close(temp_fd);
421 return -1; 423 return -1;
424 }
422 425
423 playlist->filename[playlist->dirlen-1] = '\0'; 426 playlist->filename[playlist->dirlen-1] = '\0';
424 427
425 /* cannot call update_control() because of mutex */ 428 /* cannot call update_control() because of mutex */
426 result = fdprintf(playlist->control_fd, "P:%d:%s:%s\n", 429 result = fdprintf(playlist->control_fd, "P:%d:%s:%s\n",
427 PLAYLIST_CONTROL_FILE_VERSION, dir, file); 430 PLAYLIST_CONTROL_FILE_VERSION, dir, file);