Whamcloud - gitweb
LU-4629 lmv: fix issue found by Klocwork Insight tool
[fs/lustre-release.git] / lustre / utils / nidlist.c
index 31a0f8b..78e70ce 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -210,7 +208,9 @@ static char *nl_nid_lookup_ipaddr(char *nid)
                                     NI_NAMEREQD | NI_NOFQDN) == 0) {
                                         if ((p = strchr(name, '.')))
                                                 *p = '\0';
-                                        len = strlen(name) + strlen(lnet) + 2;
+                                       len = strlen(name) + 2;
+                                       if (lnet)
+                                               len += strlen(lnet);
                                         if (!(res = malloc(len)))
                                                 nl_oom();
                                         snprintf(res, len, "%s@%s", name, lnet);