From: Jeff Layton Date: Mon, 23 Mar 2009 12:13:01 +0000 (-0400) Subject: Regardless though, it's dangerous to keep invalid pointers around like X-Git-Tag: nfs-utils-1-1-6-rc3~1 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=d62365079f711b25e73522b2af380abc2a7e2788;p=nfs-utils.git Regardless though, it's dangerous to keep invalid pointers around like this. Later code changes may make it more likely for this problem to occur. Also eliminate some unneeded NULL pointer checks before freeing memory. Signed-off-by: Jeff Layton Signed-off-by: Steve Dickson --- diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c index fb97a13..509946e 100644 --- a/utils/gssd/gssd_proc.c +++ b/utils/gssd/gssd_proc.c @@ -182,9 +182,10 @@ read_service_info(char *info_file_name, char **servicename, char **servername, fail: printerr(0, "ERROR: failed to read service info\n"); if (fd != -1) close(fd); - if (*servername) free(*servername); - if (*servicename) free(*servicename); - if (*protocol) free(*protocol); + free(*servername); + free(*servicename); + free(*protocol); + *servicename = *servername = *protocol = NULL; return -1; } @@ -200,10 +201,10 @@ destroy_client(struct clnt_info *clp) if (clp->dir_fd != -1) close(clp->dir_fd); if (clp->krb5_fd != -1) close(clp->krb5_fd); if (clp->spkm3_fd != -1) close(clp->spkm3_fd); - if (clp->dirname) free(clp->dirname); - if (clp->servicename) free(clp->servicename); - if (clp->servername) free(clp->servername); - if (clp->protocol) free(clp->protocol); + free(clp->dirname); + free(clp->servicename); + free(clp->servername); + free(clp->protocol); free(clp); }