mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-06 13:07:21 +00:00
Merge "audiohook.c: Fix freeing a frame and still using it." into 13
This commit is contained in:
@@ -947,7 +947,9 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st
|
|||||||
* rely on actual media being present to do things.
|
* rely on actual media being present to do things.
|
||||||
*/
|
*/
|
||||||
if (!middle_frame->data.ptr) {
|
if (!middle_frame->data.ptr) {
|
||||||
|
if (middle_frame != start_frame) {
|
||||||
ast_frfree(middle_frame);
|
ast_frfree(middle_frame);
|
||||||
|
}
|
||||||
return start_frame;
|
return start_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ static void normalise_history(plc_state_t *s)
|
|||||||
if (s->buf_ptr == 0)
|
if (s->buf_ptr == 0)
|
||||||
return;
|
return;
|
||||||
memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr);
|
memcpy(tmp, s->history, sizeof(int16_t)*s->buf_ptr);
|
||||||
memcpy(s->history, s->history + s->buf_ptr, sizeof(int16_t) * (PLC_HISTORY_LEN - s->buf_ptr));
|
memmove(s->history, s->history + s->buf_ptr, sizeof(int16_t) * (PLC_HISTORY_LEN - s->buf_ptr));
|
||||||
memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t) * s->buf_ptr);
|
memcpy(s->history + PLC_HISTORY_LEN - s->buf_ptr, tmp, sizeof(int16_t) * s->buf_ptr);
|
||||||
s->buf_ptr = 0;
|
s->buf_ptr = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user