nwrap: Cleanup shadow getspnam() memory
[samba.git] / lib / nss_wrapper / nss_wrapper.c
index 562efba251509114fab02304579957f96c005381..914cd26e3fbd9f7ebbdab1b9bca8b24fceff4a0c 100644 (file)
@@ -5551,6 +5551,18 @@ void nwrap_destructor(void)
                nwrap_pw_global.num = 0;
        }
 
+       if (nwrap_sp_global.cache != NULL) {
+               struct nwrap_cache *c = nwrap_sp_global.cache;
+
+               nwrap_files_cache_unload(c);
+               if (c->fd >= 0) {
+                       fclose(c->fp);
+                       c->fd = -1;
+               }
+
+               nwrap_he_global.num = 0;
+       }
+
        if (nwrap_he_global.cache != NULL) {
                struct nwrap_cache *c = nwrap_he_global.cache;