From 2f879270a2fdf80ecd642d7d4a08b4733f5cdc8d Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Wed, 8 Jul 2015 15:04:20 -0700
Subject: [PATCH] Fix NULL pointer issue

---
 src/common/slurm_protocol_socket_implementation.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c
index 1123e5320a4..486da658663 100644
--- a/src/common/slurm_protocol_socket_implementation.c
+++ b/src/common/slurm_protocol_socket_implementation.c
@@ -776,6 +776,12 @@ extern void slurm_print_slurm_addr ( slurm_addr_t * address, char *buf,
 				     size_t n )
 {
 	char addrbuf[INET_ADDRSTRLEN];
+
+	if (!address) {
+		snprintf(buf, n, "NULL");
+		return;
+	}
+
 	inet_ntop(AF_INET, &address->sin_addr, addrbuf, INET_ADDRSTRLEN);
 	/* warning: silently truncates */
 	snprintf(buf, n, "%s:%d", addrbuf, ntohs(address->sin_port));
-- 
GitLab