From 3778146a5a6dbfacd7d2890ecc225444ae329c81 Mon Sep 17 00:00:00 2001 From: Dragan Cecavac Date: Mon, 28 Nov 2022 20:15:21 +0100 Subject: [PATCH] Fix invalid pointer in CommandLine destructor When CommandLine::parse is not called there is a risk that command.options can stay uninitialized. This would lead to its destructor failing after calling free() with an invalid pointer. To prevent it, this commit simply initializes command.options to NULL. The error can be reproduced by calling ykushcmd with no arguments. --- src/utils/command_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/command_parser.cpp b/src/utils/command_parser.cpp index b5794f5..7ff33ea 100644 --- a/src/utils/command_parser.cpp +++ b/src/utils/command_parser.cpp @@ -8,7 +8,7 @@ CommandLine::CommandLine() { - + command.options = NULL; } CommandLine::~CommandLine()