Fix invalid memory free
This commit is contained in:
parent
9a0b9428da
commit
f0379aa428
|
@ -544,7 +544,8 @@ int nghttp2_hd_entry_init(nghttp2_hd_entry *ent, uint8_t flags, uint8_t *name,
|
|||
return 0;
|
||||
|
||||
fail2:
|
||||
if (flags & NGHTTP2_HD_FLAG_NAME_ALLOC) {
|
||||
if ((flags & NGHTTP2_HD_FLAG_NAME_ALLOC) &&
|
||||
(flags & NGHTTP2_HD_FLAG_NAME_GIFT) == 0) {
|
||||
nghttp2_mem_free(mem, ent->nv.name);
|
||||
}
|
||||
fail:
|
||||
|
@ -1894,7 +1895,11 @@ static int hd_inflate_commit_indname(nghttp2_hd_inflater *inflater,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (inflater->index < NGHTTP2_STATIC_TABLE_LENGTH) {
|
||||
nghttp2_mem_free(mem, nv.value);
|
||||
} else {
|
||||
nghttp2_mem_free(mem, nv.name);
|
||||
}
|
||||
|
||||
return NGHTTP2_ERR_NOMEM;
|
||||
}
|
||||
|
|
|
@ -458,13 +458,14 @@ static void run_nghttp2_hd(void) {
|
|||
nghttp2_hd_inflater inflater;
|
||||
nghttp2_bufs bufs;
|
||||
int rv;
|
||||
nghttp2_nv nva1[] = {MAKE_NV(":scheme", "https"),
|
||||
MAKE_NV(":authority", "example.org"),
|
||||
nghttp2_nv nva1[] = {
|
||||
MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"),
|
||||
MAKE_NV(":path", "/slashdot"),
|
||||
MAKE_NV("accept-encoding", "gzip, deflate")};
|
||||
MAKE_NV("accept-encoding", "gzip, deflate"), MAKE_NV("foo", "bar")};
|
||||
nghttp2_nv nva2[] = {
|
||||
MAKE_NV(":scheme", "https"), MAKE_NV(":authority", "example.org"),
|
||||
MAKE_NV(":path", "/style.css"), MAKE_NV("cookie", "nghttp2=FTW")};
|
||||
MAKE_NV(":path", "/style.css"), MAKE_NV("cookie", "nghttp2=FTW"),
|
||||
MAKE_NV("foo", "bar2")};
|
||||
|
||||
rv = frame_pack_bufs_init(&bufs);
|
||||
|
||||
|
|
Loading…
Reference in New Issue