diff --git a/src/manage_scan_handler.c b/src/manage_scan_handler.c index d3f24b8367..c9df0cd29f 100644 --- a/src/manage_scan_handler.c +++ b/src/manage_scan_handler.c @@ -195,8 +195,14 @@ fork_scan_handler (const char *report_id, report_t report, task_t task, pid_t child_pid; pid_t grandchild_pid; struct sigaction action; + int ret; - pipe (pipe_fds); + if (pipe (pipe_fds)) + { + g_warning ("%s: Failed to create pipe: %s", + __func__, strerror(errno)); + return -1; + } child_pid = fork(); (void) handle_scan_queue_entry; @@ -240,10 +246,20 @@ fork_scan_handler (const char *report_id, report_t report, task_t task, exit (EXIT_FAILURE); default: // Child on success - write (pipe_fds[1], &grandchild_pid, sizeof(grandchild_pid)); - close(pipe_fds[1]); // Close output side of pipe + ret = write (pipe_fds[1], + &grandchild_pid, + sizeof(grandchild_pid)); + if (ret) + { + g_warning ("%s: Failed to write PID to pipe: %s", + __func__, strerror(errno)); + } + close (pipe_fds[1]); // Close output side of pipe sql_close_fork (); - exit(EXIT_SUCCESS); + if (ret) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); } } case -1: diff --git a/src/manage_sql.c b/src/manage_sql.c index 9c72588c61..340d8d9d71 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -19997,6 +19997,7 @@ print_report_xml_start (report_t report, report_t delta, task_t task, orig_filtered_result_count = 0; orig_f_false_positives = orig_f_warnings = orig_f_logs = orig_f_infos = 0; orig_f_holes = orig_f_criticals = 0; + host_summary_buffer = NULL; f_host_ports = NULL; f_host_holes = NULL; f_host_warnings = NULL; @@ -20595,8 +20596,8 @@ print_report_xml_start (report_t report, report_t delta, task_t task, } /* Prepare result counts. */ - int compliance_yes, compliance_no; - int compliance_incomplete, compliance_undefined; + int compliance_yes = 0, compliance_no = 0; + int compliance_incomplete = 0, compliance_undefined = 0; int total_compliance_count = 0; if (strcmp (tsk_usage_type, "audit") == 0)