about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-05-27 11:59:14 -0400
committerFedor Indutny <fedor@indutny.com>2016-05-27 11:59:14 -0400
commit28facffd6105b2da1699922bf2cbc545aa1cceae (patch)
treeaa81da0e54ae66d0a9f939d332a2f880f563fe2f
parent800432e83ea2bc09079b9487a565d41bf36f872c (diff)
downloaduv_link_t-28facffd6105b2da1699922bf2cbc545aa1cceae.tar.gz
uv_link_t: do not crash on NULL buf
-rw-r--r--src/uv_link_t.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/uv_link_t.c b/src/uv_link_t.c
index 319a2e4..08b5064 100644
--- a/src/uv_link_t.c
+++ b/src/uv_link_t.c
@@ -18,7 +18,8 @@ static void uv_link_def_alloc_cb(uv_link_t* link,
 static void uv_link_def_read_cb(uv_link_t* link,
                                 ssize_t nread,
                                 const uv_buf_t* buf) {
-  free(buf->base);
+  if (buf != NULL)
+    free(buf->base);
 }