Opened 7 years ago

Closed 7 years ago

#5594 closed Bug (invalid)

Memory leaks in tr_valloc()

Reported by: unDEFER Owned by: jordan
Priority: Normal Milestone: None Set
Component: libtransmission Version: 2.82
Severity: Normal Keywords:
Cc:

Description

Hello! The next code in tr_vallo() (Transmission/libtransmission/utils.c) obviously creates the memory leak:

  if (!buf)
    if (posix_memalign (&buf, pageSize, allocLen))
      buf = NULL; /* just retry with valloc/malloc */

The returned by posix_memalign() buf never used or deallocated.

Change History (2)

comment:1 Changed 7 years ago by livings124

  • Component changed from Transmission to libtransmission
  • Owner set to jordan

comment:2 Changed 7 years ago by mike.dld

  • Resolution set to invalid
  • Status changed from new to closed

I don't see a memory leak here. According to posix_memalign(3) man page, the function returns zero on success and non-zero error code on failure. What the man page does not say, however, is whether memptr argument value would change or not upon failure, so Transmission is being extra cautious and zeroes the [invalid] pointer just in case.

Note: See TracTickets for help on using tickets.