View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008808 | GNUnet | set service | public | 2024-05-07 05:04 | 2024-06-08 12:03 |
Reporter | ulfvonbelow | Assigned To | Florian Dold | ||
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 | 0008808: memory leak in strata_estimator_destroy in gnunet-service-setu_strata_estimator.c | ||||
Description | strata_estimator_create creates a 5-level hierarchy of allocations: a dynamically-allocated struct (1), containing a pointer to an array (2), whose elements are pointers to structs (3), which contain a pointer to an array (4), whose elements are pointers to structs (5). Only (1), (4), and (5) are being freed currently by strata_estimator_destroy. Additionally, in the "Failed to allocate memory" case of strata_estimator_create, only (1) and (5) are freed. | ||||
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 setu to log to | ||||
Additional Information | Patch attached. | ||||
Tags | No tags attached. | ||||
Attached Files | 0001-setu-fix-memory-leak-in-strata_estimator_destroy.patch (1,545 bytes)
From e5503c52754277a54e3107f622a7c73af74f3a21 Mon Sep 17 00:00:00 2001 From: ulfvonbelow <striness@tilde.club> Date: Sat, 4 May 2024 19:35:03 -0500 Subject: [PATCH] setu: fix memory leak in strata_estimator_destroy. And also in the "failed to allocate memory" case of strata_estimator_create. --- src/service/setu/gnunet-service-setu_strata_estimator.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/service/setu/gnunet-service-setu_strata_estimator.c b/src/service/setu/gnunet-service-setu_strata_estimator.c index 43ccf3afd..e5af92980 100644 --- a/src/service/setu/gnunet-service-setu_strata_estimator.c +++ b/src/service/setu/gnunet-service-setu_strata_estimator.c @@ -331,6 +331,12 @@ strata_estimator_create (unsigned int strata_count, "Failed to allocate memory for strata estimator\n"); for (j = 0; j < i; j++) ibf_destroy (se->stratas[strata_ctr]->strata[i]); + for (j = 0; j <= strata_ctr; j++) + { + GNUNET_free (se->stratas[j]->strata); + GNUNET_free (se->stratas[j]); + } + GNUNET_free (se->stratas); GNUNET_free (se); return NULL; } @@ -463,6 +469,8 @@ strata_estimator_destroy (struct MultiStrataEstimator *se) for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++) ibf_destroy (se->stratas[strata_ctr]->strata[i]); GNUNET_free (se->stratas[strata_ctr]->strata); + GNUNET_free (se->stratas[strata_ctr]); } + GNUNET_free (se->stratas); GNUNET_free (se); } -- 2.41.0 | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2024-05-07 05:04 | ulfvonbelow | New Issue | |
2024-05-07 05:04 | ulfvonbelow | Status | new => assigned |
2024-05-07 05:04 | ulfvonbelow | Assigned To | => Florian Dold |
2024-05-07 05:04 | ulfvonbelow | File Added: 0001-setu-fix-memory-leak-in-strata_estimator_destroy.patch | |
2024-05-13 10:45 | schanzen | Status | assigned => resolved |
2024-05-13 10:45 | schanzen | Resolution | open => fixed |
2024-05-13 10:45 | schanzen | Fixed in Version | => 0.21.2 |
2024-05-13 10:45 | schanzen | Note Added: 0022391 | |
2024-06-08 12:03 | schanzen | Note Added: 0022537 | |
2024-06-08 12:03 | schanzen | Status | resolved => closed |