Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/more PR/50710: David Binderman: Fix memory leak.



details:   https://anonhg.NetBSD.org/src/rev/eb5ef9377118
branches:  trunk
changeset: 343249:eb5ef9377118
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 26 16:04:12 2016 +0000

description:
PR/50710: David Binderman: Fix memory leak.

diffstat:

 distrib/utils/more/os.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 42135053cc8a -r eb5ef9377118 distrib/utils/more/os.c
--- a/distrib/utils/more/os.c   Tue Jan 26 16:02:50 2016 +0000
+++ b/distrib/utils/more/os.c   Tue Jan 26 16:04:12 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: os.c,v 1.8 2009/01/24 13:58:21 tsutsui Exp $   */
+/*     $NetBSD: os.c,v 1.9 2016/01/26 16:04:12 christos Exp $  */
 
 /*
  * Copyright (c) 1988 Mark Nudelman
@@ -35,7 +35,7 @@
 #if 0
 static char sccsid[] = "@(#)os.c       8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: os.c,v 1.8 2009/01/24 13:58:21 tsutsui Exp $");
+__RCSID("$NetBSD: os.c,v 1.9 2016/01/26 16:04:12 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -236,8 +236,10 @@
                        return (filename);
        }
 
-       if ((f = popen(cmd, "r")) == NULL)
+       if ((f = popen(cmd, "r")) == NULL) {
+               free(cmd);
                return (filename);
+       }
        free(cmd);
 
        for (p = buffer; p < &buffer[sizeof(buffer)-1];  p++)



Home | Main Index | Thread Index | Old Index