accept_sec_context: only destroy request if it is populated
[mech_eap.orig] / accept_sec_context.c
index bbce729..1223a80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -349,7 +349,7 @@ eapGssSmAcceptAuthenticate(OM_uint32 *minor,
 
     rconn = ctx->acceptorCtx.radConn;
 
-    if (rs_packet_create_acc_request(rconn, &req, NULL, NULL) != 0) {
+    if (rs_packet_create_auth_request(rconn, &req, NULL, NULL) != 0) {
         major = gssEapRadiusMapError(minor, rs_err_conn_pop(rconn));
         goto cleanup;
     }
@@ -433,7 +433,8 @@ eapGssSmAcceptAuthenticate(OM_uint32 *minor,
     major = GSS_S_CONTINUE_NEEDED;
 
 cleanup:
-    rs_request_destroy(request);
+    if (request)
+      rs_request_destroy(request);
 
     return major;
 }