Skip to content

Commit 54200dd

Browse files
Alloc memory in tfw_hpack_hdr_name_set only for dynamic indexing
We don't need to call `tfw_pool_alloc_not_align` for static index, so move it down.
1 parent 6dff362 commit 54200dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fw/hpack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,6 @@ tfw_hpack_hdr_name_set(TfwHPack *__restrict hp, TfwHttpReq *__restrict req,
11791179
if (WARN_ON_ONCE(!num || num > s_hdr->nchunks))
11801180
return T_COMPRESSION;
11811181

1182-
if (!(data = tfw_pool_alloc_not_align(it->pool, sz)))
1183-
return -ENOMEM;
1184-
11851182
d_hdr->len = sz;
11861183
d_hdr->nchunks = num;
11871184
d_hdr->flags = s_hdr->flags;
@@ -1199,6 +1196,9 @@ tfw_hpack_hdr_name_set(TfwHPack *__restrict hp, TfwHttpReq *__restrict req,
11991196
goto done;
12001197
}
12011198

1199+
if (!(data = tfw_pool_alloc_not_align(it->pool, sz)))
1200+
return -ENOMEM;
1201+
12021202
for (s = s_hdr->chunks, end = s_hdr->chunks + num; s < end; ++s) {
12031203
*d = *s;
12041204
d->data = data;

0 commit comments

Comments
 (0)