nfs_fchown_async: plug potential memleak
Spotted by clang analyzer. Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>libnfs-4.0.0-vitalif
parent
a128749648
commit
b6619d88e6
|
@ -3433,10 +3433,10 @@ int nfs_fchown_async(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int
|
||||||
chown_data->uid = uid;
|
chown_data->uid = uid;
|
||||||
chown_data->gid = gid;
|
chown_data->gid = gid;
|
||||||
|
|
||||||
|
|
||||||
data = malloc(sizeof(struct nfs_cb_data));
|
data = malloc(sizeof(struct nfs_cb_data));
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for fchown data");
|
rpc_set_error(nfs->rpc, "out of memory. failed to allocate memory for fchown data");
|
||||||
|
free(chown_data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct nfs_cb_data));
|
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);
|
memcpy(data->fh.data.data_val, nfsfh->fh.data.data_val, data->fh.data.data_len);
|
||||||
|
|
||||||
|
|
||||||
if (nfs_chown_continue_internal(nfs, data) != 0) {
|
if (nfs_chown_continue_internal(nfs, data) != 0) {
|
||||||
free_nfs_cb_data(data);
|
free_nfs_cb_data(data);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue