summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2019-11-15 16:02:43 +1100
committerDamien Miller <djm@mindrot.org>2019-11-15 16:02:43 +1100
commita16f748690139b9f452485d97511ad5e578f59b2 (patch)
tree4c3d8f882fc07737808ded06e2e285d2e5404c70 /openbsd-compat
parentfd37cdeafe25adfcdc752280f535d28de7997ff1 (diff)
upstream commit
revision 1.44 date: 2015/09/14 16:09:13; author: tedu; state: Exp; lines: +3 -5; commitid: iWfSX2BIn0sLw62l; remove null check before free. from Michael McConville ok semarie
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/glob.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c
index d4e052fa0..7409b96e1 100644
--- a/openbsd-compat/glob.c
+++ b/openbsd-compat/glob.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: glob.c,v 1.43 2015/06/13 16:57:04 deraadt Exp $ */ 1/* $OpenBSD: glob.c,v 1.44 2015/09/14 16:09:13 tedu Exp $ */
2/* 2/*
3 * Copyright (c) 1989, 1993 3 * Copyright (c) 1989, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -968,15 +968,13 @@ globfree(glob_t *pglob)
968 if (pglob->gl_pathv != NULL) { 968 if (pglob->gl_pathv != NULL) {
969 pp = pglob->gl_pathv + pglob->gl_offs; 969 pp = pglob->gl_pathv + pglob->gl_offs;
970 for (i = pglob->gl_pathc; i--; ++pp) 970 for (i = pglob->gl_pathc; i--; ++pp)
971 if (*pp) 971 free(*pp);
972 free(*pp);
973 free(pglob->gl_pathv); 972 free(pglob->gl_pathv);
974 pglob->gl_pathv = NULL; 973 pglob->gl_pathv = NULL;
975 } 974 }
976 if (pglob->gl_statv != NULL) { 975 if (pglob->gl_statv != NULL) {
977 for (i = 0; i < pglob->gl_pathc; i++) { 976 for (i = 0; i < pglob->gl_pathc; i++) {
978 if (pglob->gl_statv[i] != NULL) 977 free(pglob->gl_statv[i]);
979 free(pglob->gl_statv[i]);
980 } 978 }
981 free(pglob->gl_statv); 979 free(pglob->gl_statv);
982 pglob->gl_statv = NULL; 980 pglob->gl_statv = NULL;