From bdca742ac8bf379d18c9f47baec9e35e94103d50 Mon Sep 17 00:00:00 2001 From: Dominik Bartkiewicz <bart@schedmd.com> Date: Mon, 13 Jun 2016 12:29:35 +0200 Subject: [PATCH] fix 'CID 45058: Resource leak (RESOURCE_LEAK)' --- src/common/hostlist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/hostlist.c b/src/common/hostlist.c index dd57f3599ea..f9cb0a4a6e2 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) { -- GitLab