Opened 10 years ago

Last modified 7 years ago

#1034 closed defect (Fixed)

Memory Leak When nofile Limit Hit

Reported by: BarkerJr Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.1.17-rc
Severity: Keywords:
Cc: BarkerJr, arma, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

In src/or/command.c, line 280, control is returned while not freeing memory allocated on line 273.

273: char *onionskin = tor_malloc(ONIONSKIN_CHALLENGE_LEN);

280: return;

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (5)

comment:1 Changed 10 years ago by arma

Looks like this leaks every time we try to add an onionskin to our
queue but the queue is too full. Specifically, in onion.c line 66
we should free tmp->onionskin too.

diff --git a/src/or/onion.c b/src/or/onion.c
index b49a86a..5230010 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -63,6 +63,7 @@ onion_pending_add(or_circuit_t *circ, char *onionskin)

"creation requests! Please consider using the "
"MaxAdvertisedBandwidth config option or choosing a more "
"restricted exit policy.");

+ tor_free(tmp->onionskin);

tor_free(tmp);
return -1;

}

Wonder if we should try to squeeze this into 0.2.1.18. ("Come on, what could
it break, of course we can release the new stable without any testing.") I think
the answer is no, it waits for 0.2.1.19.

comment:2 Changed 10 years ago by arma

optimist suggests that we might be happier with this patch instead:

--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -444,8 +444,10 @@ assign_onionskin_to_cpuworker(connection_t *cpuworker,

if (1) {

if (num_cpuworkers_busy == num_cpuworkers) {

log_debug(LD_OR,"No idle cpuworkers. Queuing.");

  • if (onion_pending_add(circ, onionskin) < 0)

+ if (onion_pending_add(circ, onionskin) < 0) {
+ tor_free(onionskin);

return -1;

+ }

return 0;

}

I'm amenable to either.

comment:3 Changed 10 years ago by arma

Fixed in 0a4e2397c0f (which will be part of 0.2.1.19)

comment:4 Changed 10 years ago by arma

flyspray2trac: bug closed.
Fixed in 0a4e2397c0f

comment:5 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.