Spotted by clang analyzer.
This also introduces asserts to help clang analyzer avoid
reporting false positives.
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
+ /* hello, clang-analyzer */
+ assert(count > 0);
+ assert(data->num_calls == 0);
+
/* trying to write more than maximum server write size, we has to chop it up into smaller
* chunks.
* we send all writes in parallel so that performance is still good.
/* trying to write more than maximum server write size, we has to chop it up into smaller
* chunks.
* we send all writes in parallel so that performance is still good.
mdata = malloc(sizeof(struct nfs_mcb_data));
if (mdata == NULL) {
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure");
mdata = malloc(sizeof(struct nfs_mcb_data));
if (mdata == NULL) {
rpc_set_error(nfs->rpc, "out of memory: failed to allocate nfs_mcb_data structure");
+ if (data->num_calls == 0)
+ free_nfs_cb_data(data);
return -1;
}
memset(mdata, 0, sizeof(struct nfs_mcb_data));
return -1;
}
memset(mdata, 0, sizeof(struct nfs_mcb_data));
rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free(mdata);
rpc_set_error(nfs->rpc, "RPC error: Failed to send WRITE call for %s", data->path);
data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
free(mdata);
+ if (data->num_calls == 0)
+ free_nfs_cb_data(data);
+