]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Regardless though, it's dangerous to keep invalid pointers around like
authorJeff Layton <jlayton@redhat.com>
Mon, 23 Mar 2009 12:13:01 +0000 (08:13 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 23 Mar 2009 12:13:01 +0000 (08:13 -0400)
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 <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/gssd/gssd_proc.c

index fb97a13e7e2761673d130397a2318db2fbf156e7..509946e62bcf922552d8408b594494e59abefe6f 100644 (file)
@@ -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);
 }