=46rom: Ricardo Maraschini
Add verification on strdup() and nspath_absolute() returns before
proceed. In case of error on this early stage, exit with=20
EXIT_FAILURE return code.
Signed-off-by: Ricardo Maraschini
---
base/nagios.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/base/nagios.c b/base/nagios.c
index bbc5a2f..5fd665e 100644
--- a/base/nagios.c
+++ b/base/nagios.c
@@ -440,6 +440,12 @@ int main(int argc, char **argv, char **env) {
else
nagios_binary_path =3D strdup(argv[0]);
=20
+
+ if (!nagios_binary_path) {
+ logit(NSLOG_RUNTIME_ERROR, TRUE, "Error: Unable to allocate memory to c=
opy nagios_binary_path\n");
+ exit(EXIT_FAILURE);
+ }
+
nagios_iobs =3D iobroker_create();
=20
/* keep monitoring things until we get a shutdown command */
--=20
1.7.4.1
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: ricardo.maraschini@opservices.com.br