]> code.citadel.org Git - citadel.git/blobdiff - citadel/netconfig.c
RNCFG: protect deletion of configs
[citadel.git] / citadel / netconfig.c
index 8afd22a4bf440539f4cc9e78f92d8c4c3ab03f5d..9e3fdc9cb84265f29908c3b072811c4246181d93 100644 (file)
@@ -1172,13 +1172,16 @@ int CtdlIsValidNode(const StrBuf **nexthop,
 void destroy_network_cfgs(void)
 {
        HashList *pCfgTypeHash = CfgTypeHash;
-       HashList *pRoomConfigs = RoomConfigs;
+       HashList *pRoomConfigs;
 
-       CfgTypeHash = NULL;
+       begin_critical_section(S_NETCONFIGS);
+       pRoomConfigs = RoomConfigs;
        RoomConfigs = NULL;
-       
-       DeleteHash(&pCfgTypeHash);
+       end_critical_section(S_NETCONFIGS);
        DeleteHash(&pRoomConfigs);
+
+       CfgTypeHash = NULL;
+       DeleteHash(&pCfgTypeHash);
 }
 
 /*