Embed nghttp2_ext_frame_payload into nghttp2_outbound_item

This commit is contained in:
Tatsuhiro Tsujikawa 2016-04-03 23:03:34 +09:00
parent 795ee8c20f
commit 31595c2416
3 changed files with 4 additions and 10 deletions

View File

@ -90,8 +90,6 @@ void nghttp2_outbound_item_free(nghttp2_outbound_item *item, nghttp2_mem *mem) {
assert(0);
break;
}
nghttp2_mem_free(mem, frame->ext.payload);
}
}
}

View File

@ -107,6 +107,9 @@ typedef struct nghttp2_outbound_item nghttp2_outbound_item;
struct nghttp2_outbound_item {
nghttp2_frame frame;
/* Storage for extension frame payload. frame->ext.payload points
to this structure to avoid frequent memory allocation. */
nghttp2_ext_frame_payload ext_frame_payload;
nghttp2_aux_data aux_data;
/* The priority used in priority comparion. Smaller is served
ealier. For PING, SETTINGS and non-DATA frames (excluding

View File

@ -470,11 +470,7 @@ int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
item->aux_data.ext.builtin = 1;
altsvc = nghttp2_mem_malloc(mem, sizeof(nghttp2_ext_altsvc));
if (altsvc == NULL) {
rv = NGHTTP2_ERR_NOMEM;
goto fail_altsvc_malloc;
}
altsvc = &item->ext_frame_payload.altsvc;
frame = &item->frame;
frame->ext.payload = altsvc;
@ -485,7 +481,6 @@ int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
rv = nghttp2_session_add_item(session, item);
if (rv != 0) {
nghttp2_frame_altsvc_free(&frame->ext, mem);
nghttp2_mem_free(mem, frame->ext.payload);
nghttp2_mem_free(mem, item);
return rv;
@ -493,8 +488,6 @@ int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
return 0;
fail_altsvc_malloc:
free(item);
fail_item_malloc:
free(buf);