1
1

Fix two Coverity complaints CID 813 (value defined and not used) and 1039 (resource leak). While doing so, found and fixed another less obvious memory leak.

This commit was SVN r18641.
Этот коммит содержится в:
Ralph Castain 2008-06-10 17:53:28 +00:00
родитель 4493ec7d7d
Коммит 1a422995ae
2 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -72,7 +72,8 @@ static void send_callback(int status,
if (num_reported == num_being_sent) { if (num_reported == num_being_sent) {
/* cancel the timer */ /* cancel the timer */
if (NULL != ev) { if (NULL != ev) {
opal_event_del(ev); opal_evtimer_del(ev);
free(ev);
ev = NULL; ev = NULL;
} }

Просмотреть файл

@ -114,6 +114,8 @@ static opal_event_t *orterun_event, *orteds_exit_event;
static char *ompi_server=NULL; static char *ompi_server=NULL;
static opal_event_t *abort_exit_event=NULL; static opal_event_t *abort_exit_event=NULL;
static bool forcibly_die = false; static bool forcibly_die = false;
static opal_event_t *timeout_ev=NULL;
/* /*
* Globals * Globals
*/ */
@ -571,8 +573,10 @@ static void job_completed(int trigpipe, short event, void *arg)
/* if the abort exit event is set, delete it */ /* if the abort exit event is set, delete it */
if (NULL != abort_exit_event) { if (NULL != abort_exit_event) {
opal_event_del(abort_exit_event); opal_evtimer_del(abort_exit_event);
free(abort_exit_event);
} }
/* close the trigger pipe */ /* close the trigger pipe */
if (0 <= trigpipe) { if (0 <= trigpipe) {
close(trigpipe); close(trigpipe);
@ -612,9 +616,7 @@ static void job_completed(int trigpipe, short event, void *arg)
goto DONE; goto DONE;
} }
if (ORTE_SUCCESS != (rc = orte_plm.terminate_orteds())) { if (ORTE_SUCCESS != (rc = orte_plm.terminate_orteds())) {
opal_event_t *ev;
/* since we know that the sends didn't completely go out, /* since we know that the sends didn't completely go out,
* we know that the prior event will never fire. Delete it * we know that the prior event will never fire. Delete it
* for completeness, and replace it with a timeout so * for completeness, and replace it with a timeout so
@ -627,7 +629,7 @@ static void job_completed(int trigpipe, short event, void *arg)
/* we are totally hozed */ /* we are totally hozed */
goto DONE; goto DONE;
} }
ORTE_DETECT_TIMEOUT(&ev, daemons->num_procs, ORTE_DETECT_TIMEOUT(&timeout_ev, daemons->num_procs,
orte_timeout_usec_per_proc, orte_timeout_usec_per_proc,
orte_max_timeout, terminated); orte_max_timeout, terminated);
} }
@ -667,6 +669,12 @@ static void terminated(int trigpipe, short event, void *arg)
close(trigpipe); close(trigpipe);
} }
/* clear the event timer */
if (NULL != timeout_ev) {
opal_evtimer_del(timeout_ev);
free(timeout_ev);
}
/* Remove the TERM and INT signal handlers */ /* Remove the TERM and INT signal handlers */
opal_signal_del(&term_handler); opal_signal_del(&term_handler);
opal_signal_del(&int_handler); opal_signal_del(&int_handler);
@ -1560,11 +1568,13 @@ static int create_app(int argc, char* argv[], orte_app_context_t **app_ptr,
if (0 == param_len) { if (0 == param_len) {
orte_show_help("help-orterun.txt", "orterun:empty-prefix", orte_show_help("help-orterun.txt", "orterun:empty-prefix",
true, orterun_basename, orterun_basename); true, orterun_basename, orterun_basename);
free(param);
return ORTE_ERR_FATAL; return ORTE_ERR_FATAL;
} }
} }
app->prefix_dir = strdup(param); app->prefix_dir = strdup(param);
free(param);
} }
} }