about summary refs log tree commit homepage
path: root/trywrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'trywrite.c')
-rw-r--r--trywrite.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/trywrite.c b/trywrite.c
index c872609..7ade425 100644
--- a/trywrite.c
+++ b/trywrite.c
@@ -12,10 +12,14 @@ struct mog_wbuf {
 
 static void * wbuf_newv(size_t total, struct iovec *iov, int iovcnt)
 {
-        struct mog_wbuf *wbuf = xmalloc(sizeof(struct mog_wbuf) + total);
-        void *dst = wbuf->buf;
+        struct mog_wbuf *wbuf = malloc(sizeof(struct mog_wbuf) + total);
+        void *dst;
         int i;
 
+        if (!wbuf) return MOG_WR_ERROR;
+
+        dst = wbuf->buf;
+
         wbuf->len = total;
         wbuf->off = 0;