diff options
Diffstat (limited to 'mgmt_fn.c')
-rw-r--r-- | mgmt_fn.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -17,7 +17,16 @@ get_path(struct iovec *dst, struct mog_mgmt *mgmt, char *buf, bool sdup) char *path; if (sdup) { - path = xmalloc(dst->iov_len + 1); + path = malloc(dst->iov_len + 1); + if (!path) { + struct iovec iov; + + IOV_STR(&iov, "ERROR: out-of-memory\r\n"); + mog_mgmt_writev(mgmt, &iov, 1); + + return NULL; + } + memcpy(path, dst->iov_base, dst->iov_len); } else { path = dst->iov_base; |