1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-14 17:24:04 +00:00

Do not leak old time format if it is replaced in same format.

This commit is contained in:
nicm
2026-04-14 11:25:41 +00:00
parent 06178a3283
commit 82afeac7db

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: format.c,v 1.358 2026/04/14 07:24:23 nicm Exp $ */
/* $OpenBSD: format.c,v 1.359 2026/04/14 11:25:41 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -5047,8 +5047,10 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen,
if (strchr(fm->argv[0], 'p') != NULL)
modifiers |= FORMAT_PRETTY;
else if (fm->argc >= 2 &&
strchr(fm->argv[0], 'f') != NULL)
strchr(fm->argv[0], 'f') != NULL) {
free(time_format);
time_format = format_strip(fm->argv[1]);
}
break;
case 'q':
if (fm->argc < 1)