Skip to content
Snippets Groups Projects
Commit d22fd3e3 authored by Jonathan Rose's avatar Jonathan Rose
Browse files

jitterbuf: Fix memory leak on jitter buffer reset

(issue ASTERISK-22467)
Reported by: Corey Farrell
Patches:
    jitterbuf-jb_reset-leak-1.8.patch
    jitterbuf-jb_reset-leak-11up.patch
........

Merged revisions 401786 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 401787 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 401788 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 95d8977e
No related branches found
No related tags found
No related merge requests found
...@@ -73,10 +73,12 @@ static void decrement_losspct(jitterbuf *jb) ...@@ -73,10 +73,12 @@ static void decrement_losspct(jitterbuf *jb)
void jb_reset(jitterbuf *jb) void jb_reset(jitterbuf *jb)
{ {
/* only save settings */ /* only save settings and free list */
jb_conf s = jb->info.conf; jb_conf s = jb->info.conf;
jb_frame *fr = jb->free;
memset(jb, 0, sizeof(*jb)); memset(jb, 0, sizeof(*jb));
jb->info.conf = s; jb->info.conf = s;
jb->free = fr;
/* initialize length, using the default value */ /* initialize length, using the default value */
jb->info.current = jb->info.target = jb->info.conf.target_extra = JB_TARGET_EXTRA; jb->info.current = jb->info.target = jb->info.conf.target_extra = JB_TARGET_EXTRA;
...@@ -87,7 +89,7 @@ jitterbuf * jb_new() ...@@ -87,7 +89,7 @@ jitterbuf * jb_new()
{ {
jitterbuf *jb; jitterbuf *jb;
if (!(jb = ast_malloc(sizeof(*jb)))) if (!(jb = ast_calloc(1, sizeof(*jb))))
return NULL; return NULL;
jb_reset(jb); jb_reset(jb);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment