summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/action.c3
-rw-r--r--apps/debug_menu.c3
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c3
-rw-r--r--apps/gui/skin_engine/skin_parser.c4
-rw-r--r--apps/playback.c3
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/rbcodec_helpers.c5
-rw-r--r--apps/recorder/pcm_record.c3
-rw-r--r--apps/talk.c12
9 files changed, 14 insertions, 28 deletions
diff --git a/apps/action.c b/apps/action.c
index da08e29dbb..8c03ca4d65 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -1219,8 +1219,7 @@ int action_set_keymap_handle(int handle, int count)
1219 return -1; 1219 return -1;
1220#else 1220#else
1221 /* free an existing remap */ 1221 /* free an existing remap */
1222 if (action_last.key_remap > 0) 1222 action_last.key_remap = core_free(action_last.key_remap);
1223 action_last.key_remap = core_free(action_last.key_remap);
1224 1223
1225 /* if clearing the remap, we're done */ 1224 /* if clearing the remap, we're done */
1226 if (count <= 0 || handle <= 0) 1225 if (count <= 0 || handle <= 0)
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index b034f25df0..d17668ade5 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -520,8 +520,7 @@ static int bf_action_cb(int action, struct gui_synclist* list)
520 /* for some reason simplelist doesn't allow adding items here if 520 /* for some reason simplelist doesn't allow adding items here if
521 * info.get_name is given, so use normal list api */ 521 * info.get_name is given, so use normal list api */
522 gui_synclist_set_nb_items(list, core_get_num_blocks()); 522 gui_synclist_set_nb_items(list, core_get_num_blocks());
523 if (handle > 0) 523 core_free(handle);
524 core_free(handle);
525 } 524 }
526 action = ACTION_REDRAW; 525 action = ACTION_REDRAW;
527 } 526 }
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index 146dccb18a..1def0812da 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -267,8 +267,7 @@ void skin_backdrop_unload(int backdrop_id)
267 backdrops[backdrop_id].ref_count--; 267 backdrops[backdrop_id].ref_count--;
268 if (backdrops[backdrop_id].ref_count <= 0) 268 if (backdrops[backdrop_id].ref_count <= 0)
269 { 269 {
270 if (backdrops[backdrop_id].buflib_handle > 0) 270 core_free(backdrops[backdrop_id].buflib_handle);
271 core_free(backdrops[backdrop_id].buflib_handle);
272 backdrops[backdrop_id].buffer = NULL; 271 backdrops[backdrop_id].buffer = NULL;
273 backdrops[backdrop_id].buflib_handle = -1; 272 backdrops[backdrop_id].buflib_handle = -1;
274 backdrops[backdrop_id].loaded = false; 273 backdrops[backdrop_id].loaded = false;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 6021f0647c..26a251bb4b 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1829,9 +1829,7 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data)
1829abort: 1829abort:
1830 wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */ 1830 wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */
1831 wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL); 1831 wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL);
1832 if (wps_data->buflib_handle > 0) 1832 wps_data->buflib_handle = core_free(wps_data->buflib_handle);
1833 core_free(wps_data->buflib_handle);
1834 wps_data->buflib_handle = -1;
1835#endif 1833#endif
1836} 1834}
1837 1835
diff --git a/apps/playback.c b/apps/playback.c
index 7fdb302d71..9b67f2ccc7 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3683,8 +3683,7 @@ void audio_hard_stop(void)
3683#ifdef PLAYBACK_VOICE 3683#ifdef PLAYBACK_VOICE
3684 voice_stop(); 3684 voice_stop();
3685#endif 3685#endif
3686 if (audiobuf_handle > 0) 3686 audiobuf_handle = core_free(audiobuf_handle);
3687 audiobuf_handle = core_free(audiobuf_handle);
3688} 3687}
3689 3688
3690/* Resume playback if paused */ 3689/* Resume playback if paused */
diff --git a/apps/plugin.c b/apps/plugin.c
index 888a9e109c..4016040c5a 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -839,8 +839,7 @@ int plugin_load(const char* plugin, const void* parameter)
839 } 839 }
840 lc_close(current_plugin_handle); 840 lc_close(current_plugin_handle);
841 current_plugin_handle = pfn_tsr_exit = NULL; 841 current_plugin_handle = pfn_tsr_exit = NULL;
842 if (plugin_buffer_handle > 0) 842 plugin_buffer_handle = core_free(plugin_buffer_handle);
843 plugin_buffer_handle = core_free(plugin_buffer_handle);
844 } 843 }
845 844
846 splash(0, ID2P(LANG_WAIT)); 845 splash(0, ID2P(LANG_WAIT));
@@ -921,8 +920,7 @@ int plugin_load(const char* plugin, const void* parameter)
921 { /* close handle if plugin is no tsr one */ 920 { /* close handle if plugin is no tsr one */
922 lc_close(current_plugin_handle); 921 lc_close(current_plugin_handle);
923 current_plugin_handle = NULL; 922 current_plugin_handle = NULL;
924 if (plugin_buffer_handle > 0) 923 plugin_buffer_handle = core_free(plugin_buffer_handle);
925 plugin_buffer_handle = core_free(plugin_buffer_handle);
926 } 924 }
927 925
928 talk_buffer_set_policy(TALK_BUFFER_DEFAULT); 926 talk_buffer_set_policy(TALK_BUFFER_DEFAULT);
diff --git a/apps/rbcodec_helpers.c b/apps/rbcodec_helpers.c
index 78e068ded7..b856d7355d 100644
--- a/apps/rbcodec_helpers.c
+++ b/apps/rbcodec_helpers.c
@@ -87,10 +87,7 @@ void tdspeed_free_buffers(int32_t **buffers, int nbuf)
87{ 87{
88 for (int i = 0; i < nbuf; i++) 88 for (int i = 0; i < nbuf; i++)
89 { 89 {
90 if (handles[i] > 0) 90 handles[i] = core_free(handles[i]);
91 core_free(handles[i]);
92
93 handles[i] = 0;
94 buffers[i] = NULL; 91 buffers[i] = NULL;
95 } 92 }
96} 93}
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index 0f6e8469ec..d3d45d3e1c 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -1437,8 +1437,7 @@ static void on_close_recording(void)
1437 audio_set_output_source(AUDIO_SRC_PLAYBACK); 1437 audio_set_output_source(AUDIO_SRC_PLAYBACK);
1438 pcm_apply_settings(); 1438 pcm_apply_settings();
1439 1439
1440 if (pcmrec_handle > 0) 1440 pcmrec_handle = core_free(pcmrec_handle);
1441 pcmrec_handle = core_free(pcmrec_handle);
1442 talk_buffer_set_policy(TALK_BUFFER_DEFAULT); 1441 talk_buffer_set_policy(TALK_BUFFER_DEFAULT);
1443 1442
1444 send_event(RECORDING_EVENT_STOP, NULL); 1443 send_event(RECORDING_EVENT_STOP, NULL);
diff --git a/apps/talk.c b/apps/talk.c
index 1be2a041c2..a7af58c273 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -226,7 +226,7 @@ static int shrink_callback(int handle, unsigned hints, void *start, size_t old_s
226 226
227 mutex_lock(&read_buffer_mutex); 227 mutex_lock(&read_buffer_mutex);
228 /* the clip buffer isn't usable without index table */ 228 /* the clip buffer isn't usable without index table */
229 if (handle == index_handle && talk_handle > 0) 229 if (handle == index_handle)
230 talk_handle = core_free(talk_handle); 230 talk_handle = core_free(talk_handle);
231 if (h) 231 if (h)
232 *h = core_free(handle); 232 *h = core_free(handle);
@@ -546,8 +546,7 @@ static bool create_clip_buffer(size_t max_size)
546 546
547alloc_err: 547alloc_err:
548 talk_status = TALK_STATUS_ERR_ALLOC; 548 talk_status = TALK_STATUS_ERR_ALLOC;
549 if (index_handle > 0) 549 index_handle = core_free(index_handle);
550 index_handle = core_free(index_handle);
551 return false; 550 return false;
552} 551}
553static inline int load_voicefile_failure(int fd) 552static inline int load_voicefile_failure(int fd)
@@ -621,8 +620,7 @@ static bool load_voicefile_data(int fd)
621 620
622 /* just allocate, populate on an as-needed basis later 621 /* just allocate, populate on an as-needed basis later
623 * re-create the clip buffer to ensure clip_ctx is up-to-date */ 622 * re-create the clip buffer to ensure clip_ctx is up-to-date */
624 if (talk_handle > 0) 623 talk_handle = core_free(talk_handle);
625 talk_handle = core_free(talk_handle);
626 if (!create_clip_buffer(voicebuf_size)) 624 if (!create_clip_buffer(voicebuf_size))
627 return false; 625 return false;
628 626
@@ -823,8 +821,8 @@ void talk_init(void)
823 voicefile_size = has_voicefile = 0; 821 voicefile_size = has_voicefile = 0;
824 /* need to free these as their size depends on the voice file, and 822 /* need to free these as their size depends on the voice file, and
825 * this function is called when the talk voice file changes */ 823 * this function is called when the talk voice file changes */
826 if (index_handle > 0) index_handle = core_free(index_handle); 824 index_handle = core_free(index_handle);
827 if (talk_handle > 0) talk_handle = core_free(talk_handle); 825 talk_handle = core_free(talk_handle);
828 /* don't free thumb handle, it doesn't depend on the actual voice file 826 /* don't free thumb handle, it doesn't depend on the actual voice file
829 * and so we can re-use it if it's already allocated in any event */ 827 * and so we can re-use it if it's already allocated in any event */
830 828