free_nfs_cb_data: make static and drop superfluous nullptr checks / assignments
authorArne Redlich <arne.redlich@googlemail.com>
Mon, 17 Feb 2014 22:34:18 +0000 (23:34 +0100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 20 Feb 2014 02:52:05 +0000 (18:52 -0800)
free() can cope with nullptrs and there's no point in null-ing free'd members
as the containing struct is free'd as well.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
lib/libnfs.c

index 2599accf6e14877b38b4a5dc9cf258ef9fbaff43..eab8fd2d936216408167d6f822604c66f2bc473f 100644 (file)
@@ -524,28 +524,16 @@ int rpc_connect_program_async(struct rpc_context *rpc, char *server, int program
        return 0;
 }
 
-void free_nfs_cb_data(struct nfs_cb_data *data)
+static void free_nfs_cb_data(struct nfs_cb_data *data)
 {
-       if (data->saved_path != NULL) {
-               free(data->saved_path);
-               data->saved_path = NULL;
-       }
-
        if (data->continue_data != NULL) {
                assert(data->free_continue_data);
                data->free_continue_data(data->continue_data);
-               data->continue_data = NULL;
        }
 
-       if (data->fh.data.data_val != NULL) {
-               free(data->fh.data.data_val);
-               data->fh.data.data_val = NULL;
-       }
-
-       if (data->buffer != NULL) {
-               free(data->buffer);
-               data->buffer = NULL;
-       }
+       free(data->saved_path);
+       free(data->fh.data.data_val);
+       free(data->buffer);
 
        free(data);
 }