libgpo: Fix CID 1422262 Explicit null dereferenced
authorVolker Lendecke <vl@samba.org>
Tue, 21 Nov 2017 19:30:08 +0000 (20:30 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 21 Nov 2017 21:04:13 +0000 (22:04 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libgpo/pygpo.c

index a54ddb98fe73caa1a3d05e5da5e37ea0ebbd77e6..619985239cb40db193bd554710144926cea66588 100644 (file)
@@ -175,12 +175,16 @@ static int py_ads_init(ADS *self, PyObject *args, PyObject *kwds)
        }
 
        if (lp_obj) {
+               bool ok;
                lp_ctx = pytalloc_get_type(lp_obj, struct loadparm_context);
                if (lp_ctx == NULL) {
                        return -1;
                }
+               ok = lp_load_initial_only(lp_ctx->szConfigFile);
+               if (!ok) {
+                       return -1;
+               }
        }
-       if (!lp_load_initial_only(lp_ctx->szConfigFile)) return -1;
 
        if (self->cli_creds) {
                realm = cli_credentials_get_realm(self->cli_creds);