Skip to content

Commit

Permalink
Fix memleak: free the job object returned.
Browse files Browse the repository at this point in the history
Change-Id: If0701b37b095317751868e0c481aa6560bb2564e
  • Loading branch information
nikhil-jain committed Jan 31, 2018
1 parent 7969ee6 commit 5a82e29
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/libjsc/jstatctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ static bool job_is_finished (const char *state)
static void job_state_cb (flux_t *h, flux_msg_handler_t *mh,
const flux_msg_t *msg, void *arg)
{
json_object *jcb = NULL;
int64_t jobid = -1;
const char *topic = NULL;
const char *state = NULL;
Expand All @@ -1108,12 +1109,13 @@ static void job_state_cb (flux_t *h, flux_msg_handler_t *mh,
if (strcmp (state, jsc_job_num2state (J_RESERVED)) == 0)
fixup_newjob_event (h, jobid);

if (invoke_cbs (h, jobid, get_update_jcb (h, jobid, state), 0) < 0)
if (invoke_cbs (h, jobid, jcb = get_update_jcb (h, jobid, state), 0) < 0)
flux_log (h, LOG_ERR, "job_state_cb: failed to invoke callbacks");

if (job_is_finished (state))
delete_jobinfo (h, jobid);
done:
Jput (jcb);
return;
}

Expand Down

0 comments on commit 5a82e29

Please sign in to comment.