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

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