repositories
/
deb_libnfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libnfs.c: Handle OOM condition
[deb_libnfs.git]
/
lib
/
libnfs.c
diff --git
a/lib/libnfs.c
b/lib/libnfs.c
index 2f2dc4faab43a3564b43424539d79fc50d03f991..a134a2c5a1a2a6c1f8d331fd0e43ca1d0e0b759c 100644
(file)
--- a/
lib/libnfs.c
+++ b/
lib/libnfs.c
@@
-2630,6
+2630,13
@@
static void nfs_create_2_cb(struct rpc_context *rpc, int status, void *command_d
/* copy the filehandle */
nfsfh->fh.data.data_len = res->LOOKUP3res_u.resok.object.data.data_len;
nfsfh->fh.data.data_val = malloc(nfsfh->fh.data.data_len);
/* copy the filehandle */
nfsfh->fh.data.data_len = res->LOOKUP3res_u.resok.object.data.data_len;
nfsfh->fh.data.data_val = malloc(nfsfh->fh.data.data_len);
+ if (nfsfh->fh.data.data_val == NULL) {
+ rpc_set_error(nfs->rpc, "Out of memory: Failed to allocate fh structure");
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free_nfs_cb_data(data);
+ free(nfsfh);
+ return -1;
+ }
memcpy(nfsfh->fh.data.data_val, res->LOOKUP3res_u.resok.object.data.data_val, nfsfh->fh.data.data_len);
/* Try to truncate it if we were requested to */
memcpy(nfsfh->fh.data.data_val, res->LOOKUP3res_u.resok.object.data.data_val, nfsfh->fh.data.data_len);
/* Try to truncate it if we were requested to */