Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/tic tic: free the old buffer after promoting the rec...



details:   https://anonhg.NetBSD.org/src/rev/b87aa94a9c77
branches:  trunk
changeset: 1008608:b87aa94a9c77
user:      roy <roy%NetBSD.org@localhost>
date:      Sat Mar 28 15:37:04 2020 +0000

description:
tic: free the old buffer after promoting the record type

diffstat:

 usr.bin/tic/tic.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 401a662e89f2 -r b87aa94a9c77 usr.bin/tic/tic.c
--- a/usr.bin/tic/tic.c Sat Mar 28 15:27:54 2020 +0000
+++ b/usr.bin/tic/tic.c Sat Mar 28 15:37:04 2020 +0000
@@ -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 @@
 
        /* 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 @@
                                err(EXIT_FAILURE, "encode num");
                }
                rtic->rtype = utic->rtype;
+               free(obuf);
        }
 
        cap = utic->flags.buf;



Home | Main Index | Thread Index | Old Index