Permalink
Browse files

Fixed a bunch of memory leaks in the test runners

  • Loading branch information...
derickr committed Jul 3, 2017
1 parent 94a843d commit 60603b3e26dbe393835221f56d0c4312800203bb
View
@@ -1,5 +1,5 @@
CFLAGS=-O0 -ggdb3 \
-Wall -Werror -Wextra -fsanitize=undefined \
-Wall -Werror -Wextra -fsanitize=undefined -fsanitize=address \
-Wmaybe-uninitialized -Wdeclaration-after-statement -Wmissing-field-initializers -Wshadow -Wno-unused-parameter \
-pedantic \
-DHAVE_STDINT_H -DHAVE_STRING_H -DHAVE_GETTIMEOFDAY -DHAVE_UNISTD_H -DHAVE_DIRENT_H -I.# -DDEBUG_PARSER
View
@@ -43,10 +43,16 @@ int main(int argc, char *argv[])
tzi = timelib_parse_tzfile(tz, timelib_builtin_db(), &dummy_error);
timelib_fill_holes(t, now, TIMELIB_OVERRIDE_TIME);
if (now->tz_info && (now->tz_info != tzi)) {
timelib_tzinfo_dtor(now->tz_info);
}
timelib_time_dtor(now);
timelib_update_ts(t, tzi);
timelib_dump_date(t, 1);
if (t->tz_info && (t->tz_info != tzi)) {
timelib_tzinfo_dtor(t->tz_info);
}
timelib_time_dtor(t);
if (tzi) {
timelib_tzinfo_dtor(tzi);
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
timelib_time *b = NULL, *e = NULL;
timelib_rel_time *p = NULL;
int r = 0;
int i;
int i, errors_found;
struct timelib_error_container *errors;
timelib_strtointerval(argv[1], strlen(argv[1]), &b, &e, &p, &r, &errors);
@@ -73,6 +73,7 @@ int main(int argc, char *argv[])
}
}
errors_found = errors->error_count ? 1 : 0;
timelib_error_container_dtor(errors);
return errors->error_count ? 1 : 0;
return errors_found;
}
@@ -28,7 +28,7 @@
int main(int argc, char *argv[])
{
timelib_time *t;
int i;
int i, errors_found;
struct timelib_error_container *errors;
t = timelib_parse_from_format(argv[1], argv[2], strlen(argv[2]), &errors, timelib_builtin_db(), timelib_parse_tzfile);
@@ -39,6 +39,9 @@ int main(int argc, char *argv[])
printf("E=%d ", errors->error_count);
}
timelib_dump_date(t, 1);
if (t->tz_info) {
timelib_tzinfo_dtor(t->tz_info);
}
timelib_time_dtor(t);
if (errors->warning_count) {
@@ -54,6 +57,7 @@ int main(int argc, char *argv[])
}
}
errors_found = errors->error_count ? 1 : 0;
timelib_error_container_dtor(errors);
return errors->error_count ? 1 : 0;
return errors_found;
}
@@ -28,7 +28,7 @@
int main(int argc, char *argv[])
{
timelib_time *t;
int i;
int i, errors_found;
struct timelib_error_container *errors;
t = timelib_strtotime(argv[1], strlen(argv[1]), &errors, timelib_builtin_db(), timelib_parse_tzfile);
@@ -39,6 +39,9 @@ int main(int argc, char *argv[])
printf("E=%d ", errors->error_count);
}
timelib_dump_date(t, 1);
if (t->tz_info) {
timelib_tzinfo_dtor(t->tz_info);
}
timelib_time_dtor(t);
if (errors->warning_count) {
@@ -54,6 +57,7 @@ int main(int argc, char *argv[])
}
}
errors_found = errors->error_count ? 1 : 0;
timelib_error_container_dtor(errors);
return errors->error_count ? 1 : 0;
return errors_found;
}
@@ -30,6 +30,7 @@ int main(int argc, char *argv[])
timelib_time *t;
char *tz;
timelib_tzinfo *tzi;
timelib_tzdb *zoneinfo;
int dummy_error;
if (argc < 3) {
@@ -38,7 +39,8 @@ int main(int argc, char *argv[])
}
ts = atoll(argv[1]);
tz = argv[2];
tzi = timelib_parse_tzfile(tz, timelib_zoneinfo("/usr/share/zoneinfo"), &dummy_error);
zoneinfo = timelib_zoneinfo("/usr/share/zoneinfo");
tzi = timelib_parse_tzfile(tz, zoneinfo, &dummy_error);
if (!tzi) {
printf("Timezone identifier \"%s\" does not exist\n", tz);
@@ -51,6 +53,7 @@ int main(int argc, char *argv[])
timelib_dump_date(t, 3);
timelib_tzinfo_dtor(t->tz_info);
timelib_time_dtor(t);
timelib_zoneinfo_dtor(zoneinfo);
return 0;
}

0 comments on commit 60603b3

Please sign in to comment.