diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2018-08-30 13:07:20 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2018-08-30 13:07:20 +0000 |
commit | c954147a12b46fd3bea89c0bbb7bfadc1c47080c (patch) | |
tree | 48ef32d3a0d711d14916a59f486de1bfaa95d242 | |
parent | a1a2412cbad11e800d2bf9e53a29bf9bc04a2f58 (diff) |
Practice safe free()'ing by setting alloc to NULL to
prevent double free.
Spotted by jsg@, simpler fix by myself and miko@.
ok jsg@
-rw-r--r-- | sbin/disklabel/editor.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 5412b178ca2..060d80df44e 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.347 2018/08/30 12:30:08 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.348 2018/08/30 13:07:19 krw Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -572,6 +572,7 @@ editor_allocspace(struct disklabel *lp_org) index = -1; again: free(alloc); + alloc = NULL; index++; if (index >= alloc_table_nitems) return 1; |