Blame SOURCES/Avoid-unnecessary-allocation-in-gpm_inquire_mechs_fo.patch

aa181f
From 167d9775dd88cc91f74393fa487f126d21c560c7 Mon Sep 17 00:00:00 2001
aa181f
From: Simo Sorce <simo@redhat.com>
aa181f
Date: Thu, 27 Aug 2020 17:20:44 -0400
aa181f
Subject: [PATCH] Avoid unnecessary allocation in gpm_inquire_mechs_for_name()
aa181f
aa181f
Signed-off-by: Simo Sorce <simo@redhat.com>
aa181f
[rharwood@redhat.com: clarified commit message]
aa181f
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
aa181f
(cherry picked from commit c0561c078bc22b9523ac25f515ad85b735c26a92)
aa181f
(cherry picked from commit ebd66fbf42887220a0ff38cfea03a7b20fa4da17)
aa181f
---
aa181f
 src/client/gpm_indicate_mechs.c | 12 +++---------
aa181f
 1 file changed, 3 insertions(+), 9 deletions(-)
aa181f
aa181f
diff --git a/src/client/gpm_indicate_mechs.c b/src/client/gpm_indicate_mechs.c
aa181f
index 4041dcd..73fadf0 100644
aa181f
--- a/src/client/gpm_indicate_mechs.c
aa181f
+++ b/src/client/gpm_indicate_mechs.c
aa181f
@@ -390,7 +390,7 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
aa181f
     uint32_t ret_min;
aa181f
     uint32_t ret_maj;
aa181f
     uint32_t discard;
aa181f
-    gss_OID name_type = GSS_C_NO_OID;
aa181f
+    gss_OID_desc name_type;
aa181f
     int present;
aa181f
 
aa181f
     if (!minor_status) {
aa181f
@@ -407,19 +407,14 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
aa181f
         return GSS_S_FAILURE;
aa181f
     }
aa181f
 
aa181f
-    ret_min = gp_conv_gssx_to_oid_alloc(&input_name->name_type, &name_type);
aa181f
-    if (ret_min) {
aa181f
-        ret_maj = GSS_S_FAILURE;
aa181f
-        goto done;
aa181f
-    }
aa181f
-
aa181f
     ret_maj = gss_create_empty_oid_set(&ret_min, mech_types);
aa181f
     if (ret_maj) {
aa181f
         goto done;
aa181f
     }
aa181f
 
aa181f
+    gp_conv_gssx_to_oid(&input_name->name_type, &name_type);
aa181f
     for (unsigned i = 0; i < global_mechs.info_len; i++) {
aa181f
-        ret_maj = gss_test_oid_set_member(&ret_min, name_type,
aa181f
+        ret_maj = gss_test_oid_set_member(&ret_min, &name_type,
aa181f
                                           global_mechs.info[i].name_types,
aa181f
                                           &present);
aa181f
         if (ret_maj) {
aa181f
@@ -437,7 +432,6 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
aa181f
     }
aa181f
 
aa181f
 done:
aa181f
-    gss_release_oid(&discard, &name_type);
aa181f
     if (ret_maj) {
aa181f
         gss_release_oid_set(&discard, mech_types);
aa181f
         *minor_status = ret_min;