pygpo: Fix CID 1422263 Resource leak
authorVolker Lendecke <vl@samba.org>
Wed, 28 Mar 2018 20:49:30 +0000 (15:49 -0500)
committerJeremy Allison <jra@samba.org>
Tue, 3 Apr 2018 22:44:23 +0000 (00:44 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
libgpo/pygpo.c

index ac6e3237a829e01876a997d7492c5d43d22cce78..db33602112558d6c6677bc2bb1d2bba4620e01ed 100644 (file)
@@ -264,12 +264,12 @@ static PyObject* py_ads_connect(ADS *self)
                        Py_RETURN_FALSE;
                }
                self->ads_ptr->auth.password = smb_xstrdup(passwd);
+               SAFE_FREE(passwd);
                self->ads_ptr->auth.realm =
                        smb_xstrdup(self->ads_ptr->server.realm);
                if (!strupper_m(self->ads_ptr->auth.realm)) {
                        PyErr_SetString(PyExc_SystemError, "Failed to strdup");
                        TALLOC_FREE(frame);
-                       SAFE_FREE(passwd);
                        Py_RETURN_FALSE;
                }
 
@@ -278,7 +278,6 @@ static PyObject* py_ads_connect(ADS *self)
                        PyErr_SetString(PyExc_SystemError,
                                        "ads_connect() failed");
                        TALLOC_FREE(frame);
-                       SAFE_FREE(passwd);
                        Py_RETURN_FALSE;
                }
        }