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

plug a memory leak in slurmd (leak generated only once at daemon startup)

parent 01477ecf
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,8 @@
* src/slurmd/common/setproctitle.c - argv manipulation
* $Id$
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Copyright (C) 2002-2007 The Regents of the University of California.
* Copyright (C) 2008-2009 Lawrence Livermore National Security.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Mark Grondona <mgrondona@llnl.gov>.
* CODE-OCEC-09-009. All rights reserved.
......@@ -308,3 +309,18 @@ init_setproctitle(int argc, char *argv[])
#endif /* PS_USE_CLOBBER_ARGV */
}
/* Free memory allocated by init_setproctitle.
* Used to verify that all allocated memory gets freed */
void fini_setproctitle(void)
{
#if SETPROCTITLE_STRATEGY == PS_USE_CLOBBER_ARGV
int i;
for (i = 0; environ[i] != NULL; i++) {
free(environ[i]);
}
free(environ);
environ = (char **) NULL;
#endif /* PS_USE_CLOBBER_ARGV */
}
......@@ -47,6 +47,7 @@
#ifndef HAVE_SETPROCTITLE
void setproctitle(const char *fmt, ...);
void init_setproctitle(int argc, char *argv[]);
void fini_setproctitle(void);
#endif
#endif /* _BSD_SETPROCTITLE_H */
......
......@@ -1078,9 +1078,7 @@ cleanup:
* Then exercise the slurmd functionality before executing
* > scontrol shutdown
*
* There should be some definitely lost records from
* init_setproctitle (setproctitle.c), but it should otherwise account
* for all memory.
* All allocated memory should be freed
\**************************************************************************/
static int
_slurmd_fini()
......@@ -1093,6 +1091,7 @@ _slurmd_fini()
slurm_proctrack_fini();
slurm_auth_fini();
slurmd_req(NULL); /* purge memory allocated by slurmd_req() */
fini_setproctitle();
return SLURM_SUCCESS;
}
......
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