Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de125a5

Browse filesBrowse files
mhdawsontargos
authored andcommitted
crypto: avoid double free
Coverity scan reported a free after use and I think its right. Tweak to avoid double free. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: #40380 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 7b74638 commit de125a5
Copy full SHA for de125a5

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎src/crypto/crypto_util.h‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_util.h
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,12 @@ struct EnginePointer {
550550

551551
inline void reset(ENGINE* engine_ = nullptr, bool finish_on_exit_ = false) {
552552
if (engine != nullptr) {
553-
if (finish_on_exit)
554-
ENGINE_finish(engine);
555-
ENGINE_free(engine);
553+
if (finish_on_exit) {
554+
// This also does the equivalent of ENGINE_free.
555+
CHECK_EQ(ENGINE_finish(engine), 1);
556+
} else {
557+
CHECK_EQ(ENGINE_free(engine), 1);
558+
}
556559
}
557560
engine = engine_;
558561
finish_on_exit = finish_on_exit_;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.