Skip to content

Commit cd90a87

Browse files
Fix tfw_hpack_encoder_index return code
We should return error code if `tfw_hpack_encoder_index-> tfw_hpack_add_node` fails.
1 parent 4629b3b commit cd90a87

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

fw/hpack.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,7 +3144,7 @@ tfw_hpack_add_node(TfwHPackETbl *__restrict tbl, TfwStr *__restrict h_name,
31443144
* threads, so lock is used to protect the find/add/erase operations inside
31453145
* this procedure.
31463146
*/
3147-
static TfwHPackETblRes
3147+
static int
31483148
tfw_hpack_encoder_index(TfwHPackETbl *__restrict tbl,
31493149
TfwStr *__restrict h_name,
31503150
TfwStr *__restrict h_val,
@@ -3163,9 +3163,15 @@ tfw_hpack_encoder_index(TfwHPackETbl *__restrict tbl,
31633163

31643164
*out_index = HPACK_NODE_GET_INDEX(tbl, node);
31653165

3166-
if(res != HPACK_IDX_ST_FOUND
3167-
&& !tfw_hpack_add_node(tbl, h_name, h_val, &place))
3166+
if(res != HPACK_IDX_ST_FOUND) {
3167+
int r;
3168+
3169+
r = tfw_hpack_add_node(tbl, h_name, h_val, &place);
3170+
if (unlikely(r))
3171+
return r;
3172+
31683173
res |= HPACK_IDX_FLAG_ADD;
3174+
}
31693175

31703176
return res;
31713177
}

0 commit comments

Comments
 (0)