diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-07-25 14:50:31 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-07-25 14:53:00 +0100 |
commit | 77ec7522485c0bf1f48669d6eca0d09366c3bbd7 (patch) | |
tree | c76424544f6535bad0e7f9faab856d84d6af7b6f /apps | |
parent | d0536b8b6b5263eb54a9b4f1ef6998a8e90dbbd1 (diff) | |
download | rockbox-77ec7522485c0bf1f48669d6eca0d09366c3bbd7.tar.gz rockbox-77ec7522485c0bf1f48669d6eca0d09366c3bbd7.zip |
shortcuts: fix file handle leak on OOM condition
Change-Id: If09db7a084d83e9bdeeafb8e8f434fcb502c45c5
Diffstat (limited to 'apps')
-rw-r--r-- | apps/shortcuts.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 9955b7f19d..7b224dde2f 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -372,8 +372,11 @@ void shortcuts_init(void) | |||
372 | if (fd < 0) | 372 | if (fd < 0) |
373 | return; | 373 | return; |
374 | first_handle = core_alloc_ex("shortcuts_head", sizeof(struct shortcut_handle), &shortcut_ops); | 374 | first_handle = core_alloc_ex("shortcuts_head", sizeof(struct shortcut_handle), &shortcut_ops); |
375 | if (first_handle <= 0) | 375 | if (first_handle <= 0) { |
376 | close(fd); | ||
376 | return; | 377 | return; |
378 | } | ||
379 | |||
377 | h = core_get_data(first_handle); | 380 | h = core_get_data(first_handle); |
378 | h->next_handle = 0; | 381 | h->next_handle = 0; |
379 | 382 | ||