View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008822 | GNUnet | transport service | public | 2024-05-07 07:21 | 2024-06-08 12:03 |
Reporter | ulfvonbelow | Assigned To | schanzen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | x86-64 | OS | Guix System | OS Version | a1d711c92e |
Product Version | Git master | ||||
Fixed in Version | 0.21.2 | ||||
Summary | 0008822: two more memory leaks in gnunet-service-transport | ||||
Description | handle_add_address seems to act as though create_address_entry will take ownership of the memory it is passed, when in reality it just copies it. Consequently it is subsequently leaked. Separately, iterate_address_and_compare_cb assigns address_uri_without_port to the result of calling get_address_without_port twice in a row. Naturally, the first result is leaked. | ||||
Steps To Reproduce | 1. Build gnunet with --enable-sanitizer 2. Start the node with gnunet-arm -s 3. Stop the node after a bit with gnunet-arm -e 4. Observe reported memory leak wherever you've configured transport to log to | ||||
Additional Information | Patch attached. For future reference, is it better to group bugs together like this, or is one report per bug preferred? | ||||
Tags | No tags attached. | ||||
Attached Files | 0001-TRANSPORT-fix-two-memory-leaks-in-transport-service.patch (1,722 bytes)
From ea1df0d139e0984159bc1e480f2a34fbc7fc1af0 Mon Sep 17 00:00:00 2001 From: ulfvonbelow <striness@tilde.club> Date: Mon, 6 May 2024 21:36:54 -0500 Subject: [PATCH] TRANSPORT: fix two memory leaks in transport service. --- src/service/transport/gnunet-service-transport.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c index 8649b5493..40801acd8 100644 --- a/src/service/transport/gnunet-service-transport.c +++ b/src/service/transport/gnunet-service-transport.c @@ -5955,12 +5955,10 @@ handle_add_address (void *cls, "Communicator added address `%s'!\n", (const char *) &aam[1]); slen = ntohs (aam->header.size) - sizeof(*aam); - address = GNUNET_malloc (slen); - memcpy (address, &aam[1], slen); ale = create_address_entry (tc, GNUNET_TIME_relative_ntoh (aam->expiration), (enum GNUNET_NetworkType) ntohl (aam->nt), - address, + &aam[1], aam->aid, slen); GNUNET_CONTAINER_DLL_insert (tc->details.communicator.addr_head, @@ -11610,10 +11608,10 @@ iterate_address_and_compare_cb (void *cls, char *address_uri; char *prefix; char *uri_without_port; - char *address_uri_without_port = get_address_without_port (queue->address); + char *address_uri_without_port; slash = strrchr (uri, '/'); - prefix = GNUNET_strndup (uri, (slash - uri) - 2); + prefix = GNUNET_strndup (uri, (slash - uri) - 2); GNUNET_assert (NULL != slash); slash++; GNUNET_asprintf (&address_uri, -- 2.41.0 | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2024-05-07 07:21 | ulfvonbelow | New Issue | |
2024-05-07 07:21 | ulfvonbelow | File Added: 0001-TRANSPORT-fix-two-memory-leaks-in-transport-service.patch | |
2024-05-13 10:34 | schanzen | Assigned To | => schanzen |
2024-05-13 10:34 | schanzen | Status | new => resolved |
2024-05-13 10:34 | schanzen | Resolution | open => fixed |
2024-05-13 10:34 | schanzen | Fixed in Version | => 0.21.2 |
2024-05-13 10:34 | schanzen | Note Added: 0022382 | |
2024-06-08 12:03 | schanzen | Note Added: 0022545 | |
2024-06-08 12:03 | schanzen | Status | resolved => closed |