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 07:09:52 -0400 |
commit | 55567ee1d893b353906a3d1406d85ee9e904e415 (patch) | |
tree | ae15936e1809859671fc5b57cab05cd6e48a981b /res/res_calendar.c | |
parent | 317b62c8b4fc06b962a3e11749950853fb0cd897 (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); } |