Merge pull request #1046 in FS/freeswitch from ~FRANCOIS/freeswitch-fs-9693:master to master

* commit '7f017fd1d8b51e372069210cf2e59cf40ae2b0ac':
  FS-9693 fix free issue in fulldate comparison
This commit is contained in:
Mike Jerris 2016-11-08 10:09:55 -06:00
commit 113a902e26
1 changed files with 13 additions and 5 deletions

View File

@ -3343,6 +3343,7 @@ SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts)
char *p;
switch_time_t tsStart = 0;
switch_time_t tsEnd = 0;
int ret = 0;
switch_assert(dup);
@ -3358,11 +3359,17 @@ SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts)
tsStart = switch_str_time(sStart);
tsEnd = switch_str_time(sEnd);
switch_safe_free(dup);
if (tsStart == 0) return 0;
if (tsEnd == 0) return 0;
if (tsStart <= *ts && tsEnd > *ts) return 1;
if (tsStart == 0 || tsEnd == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for date time range (%s~%s)\n", sStart, sEnd);
break;
}
if (tsStart <= *ts && tsEnd > *ts) {
ret = 1;
break;
}
}
if ((cur = p)) {
@ -3371,8 +3378,9 @@ SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts)
}
}
}
switch_safe_free(dup);
return 0;
return ret;
}