]> granicus.if.org Git - sudo/commitdiff
fn_free_result() (aka sss_sudo_free_result() in sss_sudo.c) handles
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 27 Jan 2016 16:28:08 +0000 (09:28 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 27 Jan 2016 16:28:08 +0000 (09:28 -0700)
a NULL poiner so there's no need to check before calling it.  Add
missing initialization of sss_sudo_result to NULL in sudo_sss_setdefs().

plugins/sudoers/sssd.c

index 9d353fd49882bac0f0f8fcbe63913c4b00d9b178..2bbfd4934bdbbab56321fb9b292f49a55983058f 100644 (file)
@@ -416,7 +416,7 @@ static int
 sudo_sss_setdefs(struct sudo_nss *nss)
 {
     struct sudo_sss_handle *handle = nss->handle;
-    struct sss_sudo_result *sss_result;
+    struct sss_sudo_result *sss_result = NULL;
     struct sss_sudo_rule   *sss_rule;
     uint32_t sss_error;
     unsigned int i;
@@ -1267,8 +1267,7 @@ done:
        printf("%s%s%s\n", safe_cmnd ? safe_cmnd : user_cmnd,
            user_args ? " " : "", user_args ? user_args : "");
 
-    if (sss_result != NULL)
-       handle->fn_free_result(sss_result);
+    handle->fn_free_result(sss_result);
 
     debug_return_int(!found);
 }
@@ -1565,7 +1564,6 @@ sudo_sss_display_privs(struct sudo_nss *nss, struct passwd *pw,
     struct sudo_lbuf *lbuf)
 {
     struct sudo_sss_handle *handle = nss->handle;
-
     struct sss_sudo_result *sss_result = NULL;
     struct sss_sudo_rule *rule;
     unsigned int i, count = 0;
@@ -1592,8 +1590,7 @@ sudo_sss_display_privs(struct sudo_nss *nss, struct passwd *pw,
            count += sudo_sss_display_entry_short(handle, rule, lbuf);
     }
 
-    if (sss_result != NULL)
-       handle->fn_free_result(sss_result);
+    handle->fn_free_result(sss_result);
 
     if (sudo_lbuf_error(lbuf))
        debug_return_int(-1);