Module Name: src
Committed By: roy
Date: Sat Mar 28 15:37:04 UTC 2020
Modified Files:
src/usr.bin/tic: tic.c
Log Message:
tic: free the old buffer after promoting the record type
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/tic/tic.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/tic/tic.c
diff -u src/usr.bin/tic/tic.c:1.37 src/usr.bin/tic/tic.c:1.38
--- src/usr.bin/tic/tic.c:1.37 Sat Mar 28 15:22:27 2020
+++ src/usr.bin/tic/tic.c Sat Mar 28 15:37:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tic.c,v 1.37 2020/03/28 15:22:27 roy Exp $ */
+/* $NetBSD: tic.c,v 1.38 2020/03/28 15:37:04 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: tic.c,v 1.37 2020/03/28 15:22:27 roy Exp $");
+__RCSID("$NetBSD: tic.c,v 1.38 2020/03/28 15:37:04 roy Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@@ -230,6 +230,8 @@ merge(TIC *rtic, TIC *utic, int flags)
/* Promote record type if needed. */
if (rtic->rtype < utic->rtype) {
+ char *obuf = rtic->nums.buf;
+
cap = rtic->nums.buf;
rtic->nums.buf = NULL;
rtic->nums.buflen = rtic->nums.bufpos = 0;
@@ -242,6 +244,7 @@ merge(TIC *rtic, TIC *utic, int flags)
err(EXIT_FAILURE, "encode num");
}
rtic->rtype = utic->rtype;
+ free(obuf);
}
cap = utic->flags.buf;