Skip to content
Snippets Groups Projects
Commit 24aa3905 authored by Moe Jette's avatar Moe Jette
Browse files

fix corner-case slurmd memory leak

parent d5a28a1d
No related branches found
No related tags found
No related merge requests found
...@@ -979,7 +979,7 @@ stepd_list_pids(int fd, uint32_t **pids_array, uint32_t *pids_count) ...@@ -979,7 +979,7 @@ stepd_list_pids(int fd, uint32_t **pids_array, uint32_t *pids_count)
{ {
int req = REQUEST_STEP_LIST_PIDS; int req = REQUEST_STEP_LIST_PIDS;
uint32_t npids; uint32_t npids;
uint32_t *pids; uint32_t *pids = NULL;
int i; int i;
safe_write(fd, &req, sizeof(int)); safe_write(fd, &req, sizeof(int));
...@@ -991,16 +991,15 @@ stepd_list_pids(int fd, uint32_t **pids_array, uint32_t *pids_count) ...@@ -991,16 +991,15 @@ stepd_list_pids(int fd, uint32_t **pids_array, uint32_t *pids_count)
safe_read(fd, &pids[i], sizeof(uint32_t)); safe_read(fd, &pids[i], sizeof(uint32_t));
} }
if (npids == 0) { if (npids == 0)
*pids_count = 0; xfree(pids);
*pids_array = NULL;
} else {
*pids_count = npids;
*pids_array = pids;
}
*pids_count = npids;
*pids_array = pids;
return SLURM_SUCCESS; return SLURM_SUCCESS;
rwfail: rwfail:
xfree(pids);
*pids_count = 0; *pids_count = 0;
*pids_array = NULL; *pids_array = NULL;
return SLURM_ERROR; return SLURM_ERROR;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment