# Changelog
+## Unrelased
+- Fix memory leak
+
## [1.0.0] - 2023-09-13
Initial release
exit(1);
}
-const char *encode_time(time_t t) {
+char *encode_time(time_t t) {
struct tm tm;
localtime_r(&t, &tm);
const size_t size = 20;
void die_err(const char *message);
-const char *encode_time(time_t t);
+char *encode_time(time_t t);
if (tt == (time_t)-1)
die_err("Can't pack time?");
- const char *encoded = encode_time(tt);
+ char *encoded = encode_time(tt);
/* Loose check to allow for daylight savings time changes between the current
* time and the target time. :( */
assert(encoded[0] == '2');
assert(encoded[17] == '1');
assert(encoded[18] == '6');
assert(encoded[19] == '\0');
+ free(encoded);
}
static FILE *take_lock(FILE *f, char *lock_type) {
}
static void lock_and_write_line(conf_t *conf, const char *line) {
- const char *now = encode_time(time(NULL));
+ char *now = encode_time(time(NULL));
FILE *f = fopen(FILENAME, "a");
take_lock(conf, f);
if (fclose(f) != 0)
die_err("Error closing output file");
+ free(now);
write_acknowledgment(conf);
}