diff options
author | Sean Bright <sean.bright@gmail.com> | 2017-09-13 15:14:25 -0400 |
---|---|---|
committer | Sean Bright <sean.bright@gmail.com> | 2017-09-19 06:10:55 -0500 |
commit | 855746fb75d5852eb4ee2bd4c99b2debbfa045e0 (patch) | |
tree | 4ac7951246378798daa5e30faa5677ebabccfd8d /res/res_calendar.c | |
parent | 7ce044fb8f37c92410fa4f72af3e6ef6ff6c76dc (diff) |
res_calendar: Plug memory leak and micro-optimization
ast_variables_destroy is NULL safe, so there is no need to check its
argument before passing it.
ASTERISK-25524 #close
Reported by: Jesper
Change-Id: Ib0f8057642e9d471960f1a79fd42e5a3ce587d3b
Diffstat (limited to 'res/res_calendar.c')
-rw-r--r-- | res/res_calendar.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/res/res_calendar.c b/res/res_calendar.c index bf385dba6..3369f38ce 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -339,10 +339,7 @@ static void calendar_destructor(void *obj) } ast_calendar_clear_events(cal); ast_string_field_free_memory(cal); - if (cal->vars) { - ast_variables_destroy(cal->vars); - cal->vars = NULL; - } + ast_variables_destroy(cal->vars); ao2_ref(cal->events, -1); ao2_unlock(cal); } |