- in testcode, free async ids, initialise array, and check for null

pointer during test of the test.  And use exit for return to note
  irregular program stop.


git-svn-id: file:///svn/unbound/trunk@4897 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards
2018-09-13 09:45:07 +00:00
parent 9a82526b91
commit fe8b22caa1
7 changed files with 36 additions and 15 deletions
+11 -4
View File
@@ -458,6 +458,8 @@ replay_scenario_read(FILE* in, const char* name, int* lineno)
if(parse_keyword(&parse, ";"))
continue; /* comment */
if(parse_keyword(&parse, "SCENARIO_BEGIN")) {
if(scen)
fatal_exit("%d: double SCENARIO_BEGIN", *lineno);
scen = make_scenario(parse);
if(!scen)
fatal_exit("%d: could not make scen", *lineno);
@@ -801,14 +803,19 @@ macro_expand(rbtree_type* store, struct replay_runtime* runtime, char** text)
/* check for functions */
if(strcmp(buf, "time") == 0) {
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs);
if(runtime)
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs);
else
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)0);
*text += len;
return strdup(buf);
} else if(strcmp(buf, "timeout") == 0) {
time_t res = 0;
struct fake_timer* t = first_timer(runtime);
if(t && (time_t)t->tv.tv_sec >= runtime->now_secs)
res = (time_t)t->tv.tv_sec - runtime->now_secs;
if(runtime) {
struct fake_timer* t = first_timer(runtime);
if(t && (time_t)t->tv.tv_sec >= runtime->now_secs)
res = (time_t)t->tv.tv_sec - runtime->now_secs;
}
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)res);
*text += len;
return strdup(buf);