From 3f3eb54b6f782d4e6183148932f260c01cd66ca5 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 18 Apr 2017 01:45:36 +0000 Subject: free(NULL) is ok so use it; from Michael W. Bombardieri --- usr.bin/vi/cl/cl_screen.c | 44 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) (limited to 'usr.bin/vi/cl') diff --git a/usr.bin/vi/cl/cl_screen.c b/usr.bin/vi/cl/cl_screen.c index 6f75e4bc61d..c1f77ed8032 100644 --- a/usr.bin/vi/cl/cl_screen.c +++ b/usr.bin/vi/cl/cl_screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cl_screen.c,v 1.27 2016/05/28 18:30:35 martijn Exp $ */ +/* $OpenBSD: cl_screen.c,v 1.28 2017/04/18 01:45:33 deraadt Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -434,14 +434,10 @@ cl_ex_init(SCR *sp) /* Enter_standout_mode and exit_standout_mode are paired. */ if (clp->smso == NULL || clp->rmso == NULL) { - if (clp->smso != NULL) { - free(clp->smso); - clp->smso = NULL; - } - if (clp->rmso != NULL) { - free(clp->rmso); - clp->rmso = NULL; - } + free(clp->smso); + clp->smso = NULL; + free(clp->rmso); + clp->rmso = NULL; } /* @@ -515,26 +511,16 @@ cl_getcap(SCR *sp, char *name, char **elementp) static void cl_freecap(CL_PRIVATE *clp) { - if (clp->el != NULL) { - free(clp->el); - clp->el = NULL; - } - if (clp->cup != NULL) { - free(clp->cup); - clp->cup = NULL; - } - if (clp->cuu1 != NULL) { - free(clp->cuu1); - clp->cuu1 = NULL; - } - if (clp->rmso != NULL) { - free(clp->rmso); - clp->rmso = NULL; - } - if (clp->smso != NULL) { - free(clp->smso); - clp->smso = NULL; - } + free(clp->el); + clp->el = NULL; + free(clp->cup); + clp->cup = NULL; + free(clp->cuu1); + clp->cuu1 = NULL; + free(clp->rmso); + clp->rmso = NULL; + free(clp->smso); + clp->smso = NULL; } /* -- cgit v1.2.3