Opened 14 years ago

Closed 14 years ago

#740 closed Bug (fixed)

memory leak in tr_torrentParse / tr_torrentNew

Reported by: bsteinb Owned by: charles
Priority: Normal Milestone: 1.10
Component: libtransmission Version: 1.06
Severity: Normal Keywords:
Cc:

Description

Calling tr_torrentNew to create a duplicate torrent will leak memory. This is, because tr_torrentNew calls tr_torrentParse, but does not use tr_metainfoFree on return of TR_EDUPLICATE as is recommended in transmission.h ll. 425-426.

Attachments (2)

torrent_c.diff (374 bytes) - added by bsteinb 14 years ago.
transmission_h.diff (494 bytes) - added by bsteinb 14 years ago.

Download all attachments as: .zip

Change History (8)

Changed 14 years ago by bsteinb

comment:1 Changed 14 years ago by charles

  • Milestone changed from None Set to 1.10
  • Priority changed from High to Normal
  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 14 years ago by bsteinb

  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm afraid your patch does not solve the problem for me, as it only calls tr_metainfoFree() if setmeInfo is NULL, which is not the case, if tr_torrentParse() is called by tr_torrentNew().

comment:3 Changed 14 years ago by charles

  • Resolution set to fixed
  • Status changed from reopened to closed

you're right, but I still think the freeing should be done in tr_torrentParse() rather than tr_torrentNew(), otherwise there's still a potential leak from other callers invoking tr_torrentParse().

how about r5155

comment:4 Changed 14 years ago by bsteinb

This fixes the issue. How about adding this line to transmission.h?

Changed 14 years ago by bsteinb

comment:5 Changed 14 years ago by charles

  • Resolution fixed deleted
  • Status changed from closed to reopened

Freeing duplicate entries caused a regression on the mac client, so the behavior needs to go back to the old way of doing things. In transmission.h I've clarified the comments for tr_torrentParse() to better explain when the caller needs to free the tr_info.

comment:6 Changed 14 years ago by charles

  • Resolution set to fixed
  • Status changed from reopened to closed

So the new fix isn't code related, but to clarify the documentation in transmission.h

Note: See TracTickets for help on using tickets.