[ https://bro-tracker.atlassian.net/browse/BIT-1532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robin Sommer updated BIT-1532: ------------------------------ Fix Version/s: 2.5 > fix memory leak in find_all() and IRC analyzer > ---------------------------------------------- > > Key: BIT-1532 > URL: https://bro-tracker.atlassian.net/browse/BIT-1532 > Project: Bro Issue Tracker > Issue Type: Patch > Components: Bro > Reporter: Dirk Leinenbach > Fix For: 2.5 > > Attachments: 0001-fix-memory-leaks-in-find_all-and-IRC-analyzer.patch > > > fix memory leaks in find_all() and IRC analyzer > Running bro with perftools enabled (cf. [1]), I get leak reports, as > soon as my call to find_all() returns a non-empty list. > When changing find_all() in the following way (inspired by code in > IRC.cc), the leak is not reported anymore and my scripts still work as > expected: > old: > function find_all%(str: string, re: pattern%) : string_set > %{ > TableVal* a = new TableVal(string_set); > const u_char* s = str->Bytes(); > const u_char* e = s + str->Len(); > for ( const u_char* t = s; t < e; ++t ) > { > int n = re->MatchPrefix(t, e - t); > if ( n >= 0 ) > { > a->Assign(new StringVal(n, (const char*) t), 0); > t += n - 1; > } > } > return a; > %} > new: > function find_all%(str: string, re: pattern%) : string_set > %{ > TableVal* a = new TableVal(string_set); > const u_char* s = str->Bytes(); > const u_char* e = s + str->Len(); > for ( const u_char* t = s; t < e; ++t ) > { > int n = re->MatchPrefix(t, e - t); > if ( n >= 0 ) > { > Val* ma = new StringVal(n, (const char*) t); > a->Assign(ma, 0); > Unref(ma); > t += n - 1; > } > } > return a; > %} -- This message was sent by Atlassian JIRA (v7.1.0-OD-05-006#71001) _______________________________________________ bro-dev mailing list bro-dev@bro.org http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev