Fix memory leak in kpasswd server UDP error path
authorGreg Hudson <ghudson@mit.edu>
Tue, 19 Apr 2011 16:37:19 +0000 (16:37 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 19 Apr 2011 16:37:19 +0000 (16:37 +0000)
The dispatch() in kadmind's schpw.c could return a failure code with
an allocated response container.  net-server.c does not expect this
and leaks the container in the UDP case.  Free the container in
dispatch() if we are returning an error.

ticket: 6903
target_version: 1.9.1
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24886 dc483132-0cff-0310-8789-dd5450dbe970

src/kadmin/server/schpw.c

index ca07107544c593098aad4e4b1071d9e9f4358d6b..f8c235c450441158ddb98d206bc38ab1cec733d0 100644 (file)
@@ -535,6 +535,10 @@ dispatch(void *handle,
                                remote_faddr,
                                request,
                                *response);
+    if (ret) {
+        krb5_free_data(server_handle->context, *response);
+        *response = NULL;
+    }
 
 cleanup:
     if (local_kaddrs != NULL)