libwbclient: Make wbc_create_error_info not use talloc
authorVolker Lendecke <vl@samba.org>
Sat, 3 Apr 2010 12:52:08 +0000 (14:52 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 19 Apr 2010 12:27:23 +0000 (14:27 +0200)
nsswitch/libwbclient/wbc_pam.c

index 64dd02a3bfb90c519a2ea8c4512e9eb1d47605b8..f9e1e3848a5a38c1f5729a666ed597b17bd57447 100644 (file)
@@ -234,28 +234,37 @@ done:
        return wbc_status;
 }
 
+static void wbcAuthErrorInfoDestructor(void *ptr)
+{
+       struct wbcAuthErrorInfo *e = (struct wbcAuthErrorInfo *)ptr;
+       free(e->nt_string);
+       free(e->display_string);
+}
+
 static wbcErr wbc_create_error_info(const struct winbindd_response *resp,
                                    struct wbcAuthErrorInfo **_e)
 {
        wbcErr wbc_status = WBC_ERR_SUCCESS;
        struct wbcAuthErrorInfo *e;
 
-       e = talloc(NULL, struct wbcAuthErrorInfo);
+       e = (struct wbcAuthErrorInfo *)wbcAllocateMemory(
+               sizeof(struct wbcAuthErrorInfo), 1,
+               wbcAuthErrorInfoDestructor);
        BAIL_ON_PTR_ERROR(e, wbc_status);
 
        e->nt_status = resp->data.auth.nt_status;
        e->pam_error = resp->data.auth.pam_error;
-       e->nt_string = talloc_strdup(e, resp->data.auth.nt_status_string);
+       e->nt_string = strdup(resp->data.auth.nt_status_string);
        BAIL_ON_PTR_ERROR(e->nt_string, wbc_status);
 
-       e->display_string = talloc_strdup(e, resp->data.auth.error_string);
+       e->display_string = strdup(resp->data.auth.error_string);
        BAIL_ON_PTR_ERROR(e->display_string, wbc_status);
 
        *_e = e;
        e = NULL;
 
 done:
-       talloc_free(e);
+       wbcFreeMemory(e);
        return wbc_status;
 }