diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 46886d8b3b..4f0df7d50c 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -467,11 +467,11 @@ typedef struct { UINT url_scheme; } nsChannel; -struct ResponseHeader { +typedef struct ResponseHeader { struct list entry; WCHAR *header; WCHAR *data; -}; +} http_header_t; typedef struct { HRESULT (*qi)(HTMLDOMNode*,REFIID,void**); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 0aad37a268..8d4fe0a244 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -311,6 +311,18 @@ static inline BOOL is_http_channel(nsChannel *This) return This->url_scheme == URL_SCHEME_HTTP || This->url_scheme == URL_SCHEME_HTTPS; } +static void free_http_headers(struct list *list) +{ + http_header_t *iter, *iter_next; + + LIST_FOR_EACH_ENTRY_SAFE(iter, iter_next, list, http_header_t, entry) { + list_remove(&iter->entry); + heap_free(iter->header); + heap_free(iter->data); + heap_free(iter); + } +} + #define NSCHANNEL_THIS(iface) DEFINE_THIS(nsChannel, HttpChannel, iface) static nsresult NSAPI nsChannel_QueryInterface(nsIHttpChannel *iface, nsIIDRef riid, void **result) @@ -364,8 +376,6 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface) LONG ref = InterlockedDecrement(&This->ref); if(!ref) { - struct ResponseHeader *header, *next_hdr; - nsIURI_Release(NSURI(This->uri)); if(This->owner) nsISupports_Release(This->owner); @@ -377,16 +387,11 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface) nsIInterfaceRequestor_Release(This->notif_callback); if(This->original_uri) nsIURI_Release(This->original_uri); + + free_http_headers(&This->response_headers); + heap_free(This->content_type); heap_free(This->charset); - - LIST_FOR_EACH_ENTRY_SAFE(header, next_hdr, &This->response_headers, struct ResponseHeader, entry) { - list_remove(&header->entry); - heap_free(header->header); - heap_free(header->data); - heap_free(header); - } - heap_free(This); }