artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b308f3d
)
Practice safe free()'ing by setting alloc to NULL to
author
krw
<krw@openbsd.org>
Thu, 30 Aug 2018 13:07:19 +0000
(13:07 +0000)
committer
krw
<krw@openbsd.org>
Thu, 30 Aug 2018 13:07:19 +0000
(13:07 +0000)
prevent double free.
Spotted by jsg@, simpler fix by myself and miko@.
ok jsg@
sbin/disklabel/editor.c
patch
|
blob
|
history
diff --git
a/sbin/disklabel/editor.c
b/sbin/disklabel/editor.c
index
5412b17
..
060d80d
100644
(file)
--- a/
sbin/disklabel/editor.c
+++ b/
sbin/disklabel/editor.c
@@
-1,4
+1,4
@@
-/* $OpenBSD: editor.c,v 1.34
7 2018/08/30 12:30:08
krw Exp $ */
+/* $OpenBSD: editor.c,v 1.34
8 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;