From 8e5cd0d632d9a53219de8fb167ef0fefd6ac79dc Mon Sep 17 00:00:00 2001 From: Horst Schirmeier Date: Sat, 7 Feb 2015 15:58:23 +0100 Subject: [PATCH] import-trace: check 2nd cmd.parse() return value As the first cmd.parse() call was already checked before, parsing a second time should never fail. Nevertheless, we can look at the return value without much effort. Found by Coverity Scan, CID 25509. Change-Id: I58466f5d123da2b541a6a88b72bafa1f754a581e --- tools/import-trace/main.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/import-trace/main.cc b/tools/import-trace/main.cc index d039b870..dbc8bc13 100644 --- a/tools/import-trace/main.cc +++ b/tools/import-trace/main.cc @@ -175,7 +175,10 @@ int main(int argc, char *argv[]) { } // Since the importer might have added command line options, we need to // reparse all arguments. - cmd.parse(); + if (!cmd.parse()) { + std::cerr << "Error parsing arguments." << std::endl; + exit(-1); + } if (cmd[HELP] || cmd[UNKNOWN] || cmd.parser()->nonOptionsCount() > 0) { for (option::Option* opt = cmd[UNKNOWN]; opt; opt = opt->next()) {