From 592ab485a70ab4c8e4cefc37bbdfb76110f9205e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 9 Jan 2022 18:59:51 +0100 Subject: New upstream version 0.9.6 --- src/UriParse.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/UriParse.c') diff --git a/src/UriParse.c b/src/UriParse.c index 0bc8f0a..eefa8d1 100644 --- a/src/UriParse.c +++ b/src/UriParse.c @@ -2287,22 +2287,24 @@ int URI_FUNC(FreeUriMembersMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) { uri->userInfo.afterLast = NULL; } - /* Host data - IPvFuture */ + /* Host data - IPvFuture (may affect host text) */ if (uri->hostData.ipFuture.first != NULL) { + /* NOTE: .hostData.ipFuture may hold the very same range pointers + * as .hostText; then we need to prevent freeing memory twice. */ + if (uri->hostText.first == uri->hostData.ipFuture.first) { + uri->hostText.first = NULL; + uri->hostText.afterLast = NULL; + } + if (uri->hostData.ipFuture.first != uri->hostData.ipFuture.afterLast) { memory->free(memory, (URI_CHAR *)uri->hostData.ipFuture.first); } uri->hostData.ipFuture.first = NULL; uri->hostData.ipFuture.afterLast = NULL; - uri->hostText.first = NULL; - uri->hostText.afterLast = NULL; } - /* Host text (if regname, after IPvFuture!) */ - if ((uri->hostText.first != NULL) - && (uri->hostData.ip4 == NULL) - && (uri->hostData.ip6 == NULL)) { - /* Real regname */ + /* Host text (after IPvFuture, see above) */ + if (uri->hostText.first != NULL) { if (uri->hostText.first != uri->hostText.afterLast) { memory->free(memory, (URI_CHAR *)uri->hostText.first); } -- cgit v1.2.3