diff options
author | Joshua Colp <jcolp@digium.com> | 2017-11-16 08:27:04 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-11-16 08:27:04 -0600 |
commit | f9661d558b696226dbffd00d094faa22f3bd34b3 (patch) | |
tree | f8e39eb893dad5b040f35f1f9dc89ebfe42f2e52 | |
parent | f51270736248d703c8b53eff3e4de97e837eb5a1 (diff) | |
parent | b7b800b689655fcf9339f08e3d8e388a6d4c154d (diff) |
Merge "audiohook.c: Fix freeing a frame and still using it."
-rw-r--r-- | main/audiohook.c | 4 | ||||
-rw-r--r-- | main/plc.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/main/audiohook.c b/main/audiohook.c index 2cba2de6e..04a379fef 100644 --- a/main/audiohook.c +++ b/main/audiohook.c @@ -950,7 +950,9 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st * rely on actual media being present to do things. */ if (!middle_frame->data.ptr) { - ast_frfree(middle_frame); + if (middle_frame != start_frame) { + ast_frfree(middle_frame); + } return start_frame; } diff --git a/main/plc.c b/main/plc.c index b649357dc..739f7276d 100644 --- a/main/plc.c +++ b/main/plc.c @@ -96,7 +96,7 @@ static void normalise_history(plc_state_t *s) if (s->buf_ptr == 0) return; 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); s->buf_ptr = 0; } |