summaryrefslogtreecommitdiff
path: root/src/UriParse.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2022-01-09 18:59:51 +0100
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2022-01-09 18:59:51 +0100
commit592ab485a70ab4c8e4cefc37bbdfb76110f9205e (patch)
treecf0450fbe4f1bca6052f30bd66eef4c2cc839ada /src/UriParse.c
parentcb39f81ea1957f5fdd9b5b67d7d326091efd3d02 (diff)
New upstream version 0.9.6upstream/0.9.6
Diffstat (limited to 'src/UriParse.c')
-rw-r--r--src/UriParse.c18
1 files changed, 10 insertions, 8 deletions
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);
}