From 14b1e0078731fad5c3a41d1cfeb9d54bd0253aeb Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 22 Nov 2006 00:19:15 +0000
Subject: [PATCH] Remainer of memory now accounted for.

---
 src/slurmd/slurmd/req.c    | 7 +++++++
 src/slurmd/slurmd/req.h    | 2 ++
 src/slurmd/slurmd/slurmd.c | 5 +++++
 3 files changed, 14 insertions(+)

diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c
index 88082bcab84..0384ba8468a 100644
--- a/src/slurmd/slurmd/req.c
+++ b/src/slurmd/slurmd/req.c
@@ -144,6 +144,13 @@ slurmd_req(slurm_msg_t *msg)
 {
 	int rc;
 
+	if (msg == NULL) {
+		if (waiters)
+			list_destroy(waiters);
+		waiters = NULL;
+		return;
+	}
+
 	switch(msg->msg_type) {
 	case REQUEST_BATCH_JOB_LAUNCH:
 		/* Mutex locking moved into _rpc_batch_job() due to 
diff --git a/src/slurmd/slurmd/req.h b/src/slurmd/slurmd/req.h
index 652109006b4..740a6f366d5 100644
--- a/src/slurmd/slurmd/req.h
+++ b/src/slurmd/slurmd/req.h
@@ -42,6 +42,8 @@
 
 /* Process request contained in slurm message `msg' from client at
  * msg->orig_addr
+ *
+ * If msg == NULL, then purge allocated memory.
  */
 void slurmd_req(slurm_msg_t *msg);
 
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 842799c7216..30e834a0ca0 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -985,6 +985,10 @@ 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.
 \**************************************************************************/
 static int
 _slurmd_fini()
@@ -996,6 +1000,7 @@ _slurmd_fini()
 	slurm_conf_destroy();
 	slurm_proctrack_fini();
 	slurm_auth_fini();
+	slurmd_req(NULL);	/* purge memory allocated by slurmd_req() */
 	return SLURM_SUCCESS;
 }
 
-- 
GitLab