wpabuf: Allow wpabuf_resize(NULL, len) to be used
This matches with realloc() usage, i.e., allocate a new buffer if no buffer was specified.
This commit is contained in:
parent
c479e41f53
commit
859db534bf
1 changed files with 4 additions and 0 deletions
|
@ -29,6 +29,10 @@ static void wpabuf_overflow(const struct wpabuf *buf, size_t len)
|
|||
int wpabuf_resize(struct wpabuf **_buf, size_t add_len)
|
||||
{
|
||||
struct wpabuf *buf = *_buf;
|
||||
if (buf == NULL) {
|
||||
*_buf = wpabuf_alloc(add_len);
|
||||
return *_buf == NULL ? -1 : 0;
|
||||
}
|
||||
if (buf->used + add_len > buf->size) {
|
||||
unsigned char *nbuf;
|
||||
if (buf->ext_data) {
|
||||
|
|
Loading…
Reference in a new issue