Opened 12 years ago

Last modified 7 years ago

#536 closed defect (Fixed)

memory leak in trusted_dirs_load_certs_from_string

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

Description

==25743== 4,490 (3,978 direct, 512 indirect) bytes in 10 blocks are definitely l
ost in loss record 7 of 9
==25743== at 0x401D38B: malloc (vg_replace_malloc.c:149)
==25743== by 0x80EBB6C: _tor_malloc (util.c:112)
==25743== by 0x80DDCC3: authority_cert_parse_from_string (routerparse.c:1496)
==25743== by 0x80CD999: trusted_dirs_load_certs_from_string (routerlist.c:113
)
==25743== by 0x80CD946: trusted_dirs_reload_certs (routerlist.c:96)
==25743== by 0x80B01D4: do_main_loop (main.c:1347)
==25743== by 0x80B1766: tor_main (main.c:1932)
==25743== by 0x80EABB5: main (tor_main.c:28)

Looking at trusted_dirs_load_certs_from_string(), towards the bottom it calls

cert->cache_info.signed_descriptor_body = tor_strndup(s, eos-s);

yet in authority_cert_parse_from_string() we already

cert->cache_info.signed_descriptor_body = tor_malloc(len+1);
memcpy(cert->cache_info.signed_descriptor_body, s, len);
cert->cache_info.signed_descriptor_body[len] = 0;

It seems that we should do only one of these?

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (4)

comment:1 Changed 12 years ago by nickm

indeed; fixing

comment:2 Changed 12 years ago by nickm

Fixed in r12187.

comment:3 Changed 12 years ago by nickm

flyspray2trac: bug closed.

comment:4 Changed 7 years ago by nickm

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