Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
diff --git a/apps/mpeg.c b/apps/mpeg.c index 2a2821b..6d38132 100644 unsigned char * audio_get_buffer(bool talk_buf, size_t *buffer_size) { (void)talk_buf; /* always grab the voice buffer for now */ - if (buffer_size) /* special case for talk_init() */ - audio_hard_stop(); + audio_hard_stop(); + + if (!buffer_size) /* special case for talk_init() */ + return NULL; if (!audiobuf_handle) { unsigned char * audio_get_buffer(bool talk_buf, size_t *buffer_size) } mpeg_audiobuf = core_get_data(audiobuf_handle); - if (!buffer_size) /* special case for talk_init() */ - talkbuf_init(mpeg_audiobuf); - return mpeg_audiobuf; } diff --git a/firmware/buflib.c b/firmware/buflib.c index 3b4f522..dfaa47f 100644 buflib_alloc_maximum(struct buflib_context* ctx, const char* name, size_t *size, { /* limit name to 16 since that's what buflib_available() accounts for it */ char buf[16]; + *size = buflib_available(ctx); + if (*size <= 0) /* OOM */ + return -1; + strlcpy(buf, name, sizeof(buf)); return buflib_alloc_ex(ctx, *size, buf, ops); |