[1/2] nfs-utils: Removed a number of Coverity Scan RESOURCE_LEAK errors
diff mbox series

Message ID 20190826143421.13712-1-steved@redhat.com
State New
Headers show
Series
  • [1/2] nfs-utils: Removed a number of Coverity Scan RESOURCE_LEAK errors
Related show

Commit Message

Steve Dickson Aug. 26, 2019, 2:34 p.m. UTC
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 support/nfsidmap/libnfsidmap.c | 3 +++
 utils/gssd/krb5_util.c         | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Steve Dickson Aug. 26, 2019, 5:53 p.m. UTC | #1
On 8/26/19 10:34 AM, Steve Dickson wrote:
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
>  support/nfsidmap/libnfsidmap.c | 3 +++
>  utils/gssd/krb5_util.c         | 4 ++++
>  2 files changed, 7 insertions(+)
Committed...

steved.

> 
> diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
> index 7b8a871..9299e65 100644
> --- a/support/nfsidmap/libnfsidmap.c
> +++ b/support/nfsidmap/libnfsidmap.c
> @@ -486,6 +486,9 @@ out:
>  	if (gss_methods)
>  		conf_free_list(gss_methods);
>  
> +	if (nfs4_methods)
> +		conf_free_list(nfs4_methods);
> +
>  	return ret ? -ENOENT: 0;
>  }
>  
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index 454a6eb..f68be85 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -912,6 +912,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
>  				k5err = gssd_k5_err_msg(context, code);
>  				printerr(3, "%s while getting keytab entry for '%s'\n",
>  					 k5err, spn);
> +				free(k5err);
> +				k5err = NULL;
>  				/*
>  				 * We tried the active directory machine account
>  				 * with the hostname part as-is and failed...
> @@ -1231,6 +1233,8 @@ gssd_destroy_krb5_machine_creds(void)
>  			k5err = gssd_k5_err_msg(context, code);
>  			printerr(0, "WARNING: %s while destroying credential "
>  				    "cache '%s'\n", k5err, ple->ccname);
> +			free(k5err);
> +			k5err = NULL;
>  		}
>  	}
>  	krb5_free_context(context);
>

Patch
diff mbox series

diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index 7b8a871..9299e65 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -486,6 +486,9 @@  out:
 	if (gss_methods)
 		conf_free_list(gss_methods);
 
+	if (nfs4_methods)
+		conf_free_list(nfs4_methods);
+
 	return ret ? -ENOENT: 0;
 }
 
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 454a6eb..f68be85 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -912,6 +912,8 @@  find_keytab_entry(krb5_context context, krb5_keytab kt,
 				k5err = gssd_k5_err_msg(context, code);
 				printerr(3, "%s while getting keytab entry for '%s'\n",
 					 k5err, spn);
+				free(k5err);
+				k5err = NULL;
 				/*
 				 * We tried the active directory machine account
 				 * with the hostname part as-is and failed...
@@ -1231,6 +1233,8 @@  gssd_destroy_krb5_machine_creds(void)
 			k5err = gssd_k5_err_msg(context, code);
 			printerr(0, "WARNING: %s while destroying credential "
 				    "cache '%s'\n", k5err, ple->ccname);
+			free(k5err);
+			k5err = NULL;
 		}
 	}
 	krb5_free_context(context);