nwrap: Don't leak memory from gethostbyname*() functions
[obnox/samba/samba-obnox.git] / lib / nss_wrapper / nss_wrapper.c
index a6ca81637ffe3dda29b361a6855a5da37f5afe3c..be977dfad96c138fb3b7500e22ae9a076234a7c2 100644 (file)
@@ -5551,6 +5551,7 @@ void nwrap_destructor(void)
                nwrap_pw_global.num = 0;
        }
 
+#if defined(HAVE_SHADOW_H) && defined(HAVE_GETSPNAM)
        if (nwrap_sp_global.cache != NULL) {
                struct nwrap_cache *c = nwrap_sp_global.cache;
 
@@ -5562,6 +5563,7 @@ void nwrap_destructor(void)
 
                nwrap_sp_global.num = 0;
        }
+#endif /* defined(HAVE_SHADOW_H) && defined(HAVE_GETSPNAM) */
 
        if (nwrap_he_global.cache != NULL) {
                struct nwrap_cache *c = nwrap_he_global.cache;
@@ -5575,6 +5577,9 @@ void nwrap_destructor(void)
                nwrap_he_global.num = 0;
        }
 
+       free(user_addrlist.items);
+       free(user_addrlist2.items);
+
        hdestroy();
        NWRAP_UNLOCK_ALL;
 }