From: Daniel Stenberg Date: Fri, 28 May 2021 10:31:55 +0000 (+0200) Subject: c-hyper: handle NULL from hyper_buf_copy() X-Git-Tag: curl-7_78_0~247 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2619b17677b103577eeb1d57859c1df479a5213;p=thirdparty%2Fcurl.git c-hyper: handle NULL from hyper_buf_copy() Closes #7143 --- diff --git a/lib/c-hyper.c b/lib/c-hyper.c index be4618eba5..0f307f3e82 100644 --- a/lib/c-hyper.c +++ b/lib/c-hyper.c @@ -532,8 +532,12 @@ static int uploadpostfields(void *userdata, hyper_context *ctx, *chunk = NULL; /* nothing more to deliver */ else { /* send everything off in a single go */ - *chunk = hyper_buf_copy(data->set.postfields, - (size_t)data->req.p.http->postsize); + hyper_buf *copy = hyper_buf_copy(data->set.postfields, + (size_t)data->req.p.http->postsize); + if(copy) + *chunk = copy; + else + return HYPER_POLL_ERROR; data->req.upload_done = TRUE; } return HYPER_POLL_READY; @@ -552,8 +556,13 @@ static int uploadstreamed(void *userdata, hyper_context *ctx, if(!fillcount) /* done! */ *chunk = NULL; - else - *chunk = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount); + else { + hyper_buf *copy = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount); + if(copy) + *chunk = copy; + else + return HYPER_POLL_ERROR; + } return HYPER_POLL_READY; }