diff --git a/src/common/hostlist.c b/src/common/hostlist.c index dd57f3599ea5ef934d31f379447e2b7e71b1488e..f9cb0a4a6e287dd7db3b7f4648ee2da75d7edbac 100644 --- a/src/common/hostlist.c +++ b/src/common/hostlist.c @@ -2216,10 +2216,13 @@ char *hostlist_shift_range(hostlist_t hl) { int i; char *buf; - hostlist_t hltmp = hostlist_new(); - if (!hltmp || !hl) + hostlist_t hltmp ; + + if (!hl) return NULL; + hltmp = hostlist_new(); + LOCK_HOSTLIST(hl); if (hl->nranges == 0) {