From 980164cccaa37eea7494b2d238fdb3e4c73e3beb Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 1 May 2020 10:04:33 +0200 Subject: Fix various memory leaks Fixes #362 --- src/print_ddate.c | 1 + src/print_run_watch.c | 2 ++ src/print_time.c | 3 +++ 3 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/print_ddate.c b/src/print_ddate.c index 1a5258c..149a267 100644 --- a/src/print_ddate.c +++ b/src/print_ddate.c @@ -173,4 +173,5 @@ void print_ddate(yajl_gen json_gen, char *buffer, const char *format, time_t t) const size_t num = sizeof(placeholders) / sizeof(placeholder_t); buffer = format_placeholders(format, &placeholders[0], num); OUTPUT_FULL_TEXT(buffer); + free(buffer); } diff --git a/src/print_run_watch.c b/src/print_run_watch.c index d153da4..ccc7206 100644 --- a/src/print_run_watch.c +++ b/src/print_run_watch.c @@ -1,6 +1,7 @@ // vim:ts=4:sw=4:expandtab #include #include +#include #include #include #include @@ -35,4 +36,5 @@ void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const c END_COLOR; OUTPUT_FULL_TEXT(buffer); + free(buffer); } diff --git a/src/print_time.c b/src/print_time.c index 67930b7..eede31d 100644 --- a/src/print_time.c +++ b/src/print_time.c @@ -82,4 +82,7 @@ void print_time(yajl_gen json_gen, char *buffer, const char *title, const char * out: *outwalk = '\0'; OUTPUT_FULL_TEXT(buffer); + if (format_time != NULL) { + free(buffer); + } } -- cgit v1.2.3