diff options
Diffstat (limited to 'apps/talk.c')
-rw-r--r-- | apps/talk.c | 12 |
1 files changed, 5 insertions, 7 deletions
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 | ||
547 | alloc_err: | 547 | alloc_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 | } |
553 | static inline int load_voicefile_failure(int fd) | 552 | static 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 | ||