oksh sync, simplify *all* if(x)free(x); constructs, simplify x_push() and sync boilerplate while here

This commit is contained in:
tg
2015-09-05 19:19:12 +00:00
parent 719778193a
commit 4adcfe8b58
23 changed files with 87 additions and 105 deletions

12
misc.c
View File

@ -1,10 +1,10 @@
/* $OpenBSD: misc.c,v 1.40 2015/03/18 15:12:36 tedu Exp $ */
/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: path.c,v 1.13 2015/09/05 09:47:08 jsg Exp $ */
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2013, 2014, 2015
* Thorsten Glaser <tg@mirbsd.org>
* mirabilos <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
* are retained or reproduced in an accompanying document, permission
@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.238 2015/07/10 19:36:36 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.239 2015/09/05 19:19:07 tg Exp $");
#define KSH_CHVT_FLAG
#ifdef MKSH_SMALL
@ -1570,16 +1570,14 @@ do_realpath(const char *upath)
}
/* return target path */
if (ldest != NULL)
afree(ldest, ATEMP);
afree(ldest, ATEMP);
afree(ipath, ATEMP);
return (Xclose(xs, xp));
notfound:
/* save; freeing memory might trash it */
llen = errno;
if (ldest != NULL)
afree(ldest, ATEMP);
afree(ldest, ATEMP);
afree(ipath, ATEMP);
Xfree(xs, xp);
errno = llen;