Browse Source

Remove three NULL-checks before free(). ok millert@

OPENBSD_5_9
mmcc 9 years ago
parent
commit
e95c7e3634
3 changed files with 7 additions and 11 deletions
  1. +2
    -3
      src/lib/libutil/imsg.c
  2. +2
    -3
      src/lib/libutil/login_fbtab.c
  3. +3
    -5
      src/lib/libutil/pidfile.c

+ 2
- 3
src/lib/libutil/imsg.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: imsg.c,v 1.10 2015/07/19 07:18:59 nicm Exp $ */
/* $OpenBSD: imsg.c,v 1.11 2015/11/27 01:57:59 mmcc Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -118,8 +118,7 @@ again:
}
fail:
if (ifd)
free(ifd);
free(ifd);
return (n);
}


+ 2
- 3
src/lib/libutil/login_fbtab.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: login_fbtab.c,v 1.15 2015/08/20 21:34:04 deraadt Exp $ */
/* $OpenBSD: login_fbtab.c,v 1.16 2015/11/27 01:57:59 mmcc Exp $ */
/************************************************************************
* Copyright 1995 by Wietse Venema. All rights reserved. Some individual
@ -124,8 +124,7 @@ login_fbtab(const char *tty, uid_t uid, gid_t gid)
login_protect(cp, prot, uid, gid);
}
}
if (tbuf != NULL)
free(tbuf);
free(tbuf);
fclose(fp);
}


+ 3
- 5
src/lib/libutil/pidfile.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: pidfile.c,v 1.11 2015/06/03 02:24:36 millert Exp $ */
/* $OpenBSD: pidfile.c,v 1.12 2015/11/27 01:57:59 mmcc Exp $ */
/* $NetBSD: pidfile.c,v 1.4 2001/02/19 22:43:42 cgd Exp $ */
/*-
@ -55,10 +55,8 @@ pidfile(const char *basename)
if (basename == NULL)
basename = __progname;
if (pidfile_path != NULL) {
free(pidfile_path);
pidfile_path = NULL;
}
free(pidfile_path);
pidfile_path = NULL;
/* _PATH_VARRUN includes trailing / */
if (asprintf(&pidfile_path, "%s%s.pid", _PATH_VARRUN, basename) == -1)


Loading…
Cancel
Save