From: Arne Redlich Date: Mon, 17 Feb 2014 22:17:15 +0000 (+0100) Subject: nfs_fchown_async: plug potential memleak X-Git-Tag: upstream/1.9.6^2~101 X-Git-Url: https://git.piment-noir.org/?p=deb_libnfs.git;a=commitdiff_plain;h=b6619d88e6dd99e3aa07e6f333f4a6456a0b7207 nfs_fchown_async: plug potential memleak Spotted by clang analyzer. Signed-off-by: Arne Redlich --- diff --git a/lib/libnfs.c b/lib/libnfs.c index 969721e..a6987d5 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -3433,10 +3433,10 @@ int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int chown_data->uid = uid; chown_data->gid = gid; - data = malloc(sizeof(struct nfs_cb_data)); if (data == NULL) { rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for fchown data"); + free(chown_data); return -1; } memset(data, 0, sizeof(struct nfs_cb_data)); @@ -3453,7 +3453,6 @@ int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int } memcpy(data->fh.data.data_val, nfsfh->fh.data.data_val, data->fh.data.data_len); - if (nfs_chown_continue_internal(nfs, data) != 0) { free_nfs_cb_data(data); return -1;