net/libnetapi: Include netapi headers early and free on exit.
authorGünther Deschner <gd@samba.org>
Wed, 16 Apr 2008 00:16:08 +0000 (02:16 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 16 Apr 2008 00:16:08 +0000 (02:16 +0200)
Guenther

source/utils/net.c
source/utils/net.h
source/utils/net_dom.c

index 5706e336de6181ddadee1bcce114c45c34318dcb..f6851f69da67b0ddb3a0923ceaac9bcf872dd821 100644 (file)
@@ -1169,6 +1169,13 @@ static struct functable net_func[] = {
        rc = net_run_function(argc_new-1, argv_new+1, net_func, net_help);
        
        DEBUG(2,("return code = %d\n", rc));
+
+       {
+               struct libnetapi_ctx *ctx = NULL;
+               libnetapi_getctx(&ctx);
+               libnetapi_free(ctx);
+       }
+
        TALLOC_FREE(frame);
        return rc;
 }
index 3a4b1da7b08773392bb20077ebd6a27163ab4e4a..00a818a60631643d60198ea71dfe9bfdcc260eed 100644 (file)
@@ -22,6 +22,8 @@
  * include
  */
 
+#include "lib/netapi/netapi.h"
+
 typedef NTSTATUS (*rpc_command_fn)(const DOM_SID *,
                                const char *, 
                                struct cli_state *cli,
index e88bbdb276e2f247c65ffaf7221a899310578817..6e4bf14c84dc1d02e6c59af2c5b620ba0cfdc5e0 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "includes.h"
 #include "utils/net.h"
-#include "lib/netapi/netapi.h"
 
 static int net_dom_usage(int argc, const char **argv)
 {
@@ -130,7 +129,6 @@ static int net_dom_unjoin(int argc, const char **argv)
                cli_shutdown(cli);
        }
 
-       /* libnetapi_free(ctx); */
        return ret;
 }
 
@@ -244,7 +242,6 @@ static int net_dom_join(int argc, const char **argv)
                cli_shutdown(cli);
        }
 
-       /* libnetapi_free(ctx); */
        return ret;
 }