From 2fa14f9b97e2d20aedca55502ae03cf09dfe23b0 Mon Sep 17 00:00:00 2001 From: Arne Redlich Date: Mon, 17 Feb 2014 23:34:18 +0100 Subject: [PATCH] free_nfs_cb_data: make static and drop superfluous nullptr checks / assignments 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 --- lib/libnfs.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/libnfs.c b/lib/libnfs.c index 2599acc..eab8fd2 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -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); } -- 2.34.1