From: Arne Redlich Date: Mon, 17 Feb 2014 22:34:18 +0000 (+0100) Subject: free_nfs_cb_data: make static and drop superfluous nullptr checks / assignments X-Git-Tag: upstream/1.9.6^2~98 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=2fa14f9b97e2d20aedca55502ae03cf09dfe23b0 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 --- 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); }