In the unlikely event that EC_KEY_check_key() in ec_init() fails,
the group would be freed twice: once in ec_init(), and later in
group_free().
ok tobhe
-/* $OpenBSD: dh.c,v 1.30 2021/11/29 06:43:42 deraadt Exp $ */
+/* $OpenBSD: dh.c,v 1.31 2021/12/13 18:06:56 tb Exp $ */
/*
* Copyright (c) 2010-2014 Reyk Floeter <reyk@openbsd.org>
return (-1);
if (!EC_KEY_generate_key(group->ec))
return (-1);
- if (!EC_KEY_check_key(group->ec)) {
- EC_KEY_free(group->ec);
+ if (!EC_KEY_check_key(group->ec))
return (-1);
- }
return (0);
}