Closed
Bug 1372555
Opened 8 years ago
Closed 7 years ago
Fix some memory leaks found by infer
Categories
(NSPR :: NSPR, defect)
NSPR
NSPR
Tracking
(Not tracked)
RESOLVED
INACTIVE
People
(Reporter: Sylvestre, Assigned: Sylvestre)
References
Details
Attachments
(1 obsolete file)
pr/src/io/pripv6.c:163: error: MEMORY_LEAK
memory dynamically allocated to `newstack` by call to `PR_Malloc()` at line 144, column 16 is not reachable after line 163, column 5
161. _PR_ConvertToIpv6NetAddr(&tmp_ipv4addr, addr);
162.
163. > rv = PR_PushIOLayer(newfd, PR_TOP_IO_LAYER, newstack);
164. PR_ASSERT(PR_SUCCESS == rv);
165. return newfd; /* that's it */
pr/src/io/pripv6.c:199: error: MEMORY_LEAK
memory dynamically allocated to `newstack` by call to `PR_Malloc()` at line 180, column 16 is not reachable after line 199, column 5
197.
198. /* this PR_PushIOLayer call cannot fail */
199. > rv = PR_PushIOLayer(*nd, PR_TOP_IO_LAYER, newstack);
200. PR_ASSERT(PR_SUCCESS == rv);
201. return nbytes;
| Assignee | ||
Comment 1•8 years ago
|
||
Attachment #8877116 -
Flags: review?(kaie)
Comment 2•8 years ago
|
||
We should doublecheck if your patch is correct, or if your tool reported a false leak.
Reading this documentation here:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/PR_PushIOLayer
"The ownership of the storage pointed to by the caller's layer argument is relinquished to the runtime. Accessing the object via the pointer is not permitted while the runtime has ownership."
It seems that ownership of the "newstack" parameter is transferred to NSPR.
| Assignee | ||
Comment 4•8 years ago
|
||
You are probably correct. I need to follow up with infer's upstream to make sure how to avoid that in the future :)
Comment 5•8 years ago
|
||
Comment on attachment 8877116 [details] [diff] [review]
doof.diff
marking as obsolete based on your agreement
Attachment #8877116 -
Attachment is obsolete: true
Attachment #8877116 -
Flags: review?(kaie)
| Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(sledru)
| Assignee | ||
Comment 6•7 years ago
|
||
No action for a while, closing.
Status: NEW → RESOLVED
Closed: 7 years ago
QA Contact: jjones
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•