Windows: Fix usage of cm_FreeServerList
[openafs.git] / src / WINNT / afsd / cm_cell.c
index b1094c6..317cd73 100644 (file)
@@ -18,6 +18,8 @@
 #include <malloc.h>
 #include <osi.h>
 #include <string.h>
+#define STRSAFE_NO_DEPRECATE
+#include <strsafe.h>
 
 #include "afsd.h"
 
@@ -92,15 +94,13 @@ cm_cell_t *cm_UpdateCell(cm_cell_t * cp, afs_uint32 flags)
          ((cp->flags & CM_CELLFLAG_VLSERVER_INVALID)))
             ) 
     {
-        /* must empty cp->vlServersp */
-        if (cp->vlServersp) {
-            cm_FreeServerList(&cp->vlServersp, CM_FREESERVERLIST_DELETE);
-            cp->vlServersp = NULL;
-        }
-
         lock_ReleaseMutex(&cp->mx);
         mxheld = 0;
 
+        /* must empty cp->vlServersp */
+        if (cp->vlServersp)
+            cm_FreeServerList(&cp->vlServersp, CM_FREESERVERLIST_DELETE);
+
         rock.cellp = cp;
         rock.flags = flags;
         code = cm_SearchCellRegistry(1, cp->name, NULL, cp->linkedName, cm_AddCellProc, &rock);