Module Name: src
Committed By: christos
Date: Tue Jan 26 16:04:12 UTC 2016
Modified Files:
src/distrib/utils/more: os.c
Log Message:
PR/50710: David Binderman: Fix memory leak.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/more/os.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/utils/more/os.c
diff -u src/distrib/utils/more/os.c:1.8 src/distrib/utils/more/os.c:1.9
--- src/distrib/utils/more/os.c:1.8 Sat Jan 24 08:58:21 2009
+++ src/distrib/utils/more/os.c Tue Jan 26 11:04:12 2016
@@ -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 @@ glob(filename)
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++)