diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c
index 307c0aceea7c8f7dad4ccdbed05b5bef7051a0be..9262725a8512cdc91c019c938147a33e152fea78 100644
--- a/src/common/xmalloc.c
+++ b/src/common/xmalloc.c
@@ -264,6 +264,7 @@ void slurm_xfree(void **item, const char *file, int line, const char *func)
 		int *p = (int *)*item - 2;
 		/* magic cookie still there? */
 		xmalloc_assert(p[0] == XMALLOC_MAGIC);	
+		p[0] = 0;	/* make sure xfree isn't called twice */
 		MALLOC_LOCK();
 		free(p);
 		MALLOC_UNLOCK();