Closed
Bug 1259369
Opened 9 years ago
Closed 9 years ago
[Static Analysis][Resource leak] In function Resolve from ice_unittest.cpp
Categories
(Core :: WebRTC: Networking, defect, P4)
Core
WebRTC: Networking
Tracking
()
RESOLVED
DUPLICATE
of bug 1268449
Tracking | Status | |
---|---|---|
firefox48 | --- | affected |
People
(Reporter: radu.stoica, Assigned: radu.stoica)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, Whiteboard: CID 1355138)
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
ekr
:
review+
|
Details | Diff | Splinter Review |
possible resource leak - Variable res going out of scope leaks the storage it points to.
The Static Analysis tool Coverity added, ice_unittest.cpp::120
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8734296 -
Flags: review?(ekr)
Attachment #8734296 -
Flags: review?(docfaraday)
Updated•9 years ago
|
Summary: [Static Analysis] → [Static Analysis][Resource leak] In function Resolve
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8734298 -
Flags: review?(ekr)
Attachment #8734298 -
Flags: review?(docfaraday)
Updated•9 years ago
|
Summary: [Static Analysis][Resource leak] In function Resolve → [Static Analysis][Resource leak] In function Resolve from ice_unittest.cpp
Comment 3•9 years ago
|
||
Comment on attachment 8734296 [details] [diff] [review]
bug_1259369.diff
Review of attachment 8734296 [details] [diff] [review]:
-----------------------------------------------------------------
::: media/mtransport/test/ice_unittest.cpp
@@ +115,5 @@
>
> if (!strlen(str_addr)) {
> std::cerr << "inet_ntop failed" << std::endl;
> }
> + free(res);
This is not correct. See the man page for getaddrinfo.
All of the information returned by getaddrinfo() is dynamically allocated: the addrinfo
structures themselves as well as the socket address structures and the canonical host name
strings included in the addrinfo structures.
Memory allocated for the dynamically allocated structures created by a successful call to
getaddrinfo() is released by the freeaddrinfo() function. The ai pointer should be an
addrinfo structure created by a call to getaddrinfo().
Attachment #8734296 -
Flags: review?(ekr)
Attachment #8734296 -
Flags: review?(docfaraday)
Attachment #8734296 -
Flags: review-
Assignee | ||
Comment 4•9 years ago
|
||
thank you, I've changed the call from free to freeaddrinfo, see the second attachement
Comment 5•9 years ago
|
||
Comment on attachment 8734298 [details] [diff] [review]
bug_1259369.diff
Review of attachment 8734298 [details] [diff] [review]:
-----------------------------------------------------------------
r+ with one change.
::: media/mtransport/test/ice_unittest.cpp
@@ +111,3 @@
> std::cerr << "Got unexpected address family in DNS lookup: "
> << res->ai_family << std::endl;
> return "";
Let's remove this return; this will allow |res| to be cleaned up in this case, and doesn't significantly differ in behavior.
Attachment #8734298 -
Flags: review?(docfaraday) → review+
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8734340 -
Flags: review?(ekr)
Attachment #8734340 -
Flags: review?(docfaraday)
Assignee | ||
Comment 7•9 years ago
|
||
changes added
Comment 8•9 years ago
|
||
Comment on attachment 8734340 [details] [diff] [review]
bug_1259369.diff
Review of attachment 8734340 [details] [diff] [review]:
-----------------------------------------------------------------
::: media/mtransport/test/ice_unittest.cpp
@@ -108,5 @@
> sizeof(str_addr));
> break;
> - default:
> - std::cerr << "Got unexpected address family in DNS lookup: "
> - << res->ai_family << std::endl;
Leave the default case in; we would like to have this logging. Just don't return.
Attachment #8734340 -
Flags: review?(docfaraday)
Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8734296 -
Attachment is obsolete: true
Attachment #8734298 -
Attachment is obsolete: true
Attachment #8734340 -
Attachment is obsolete: true
Attachment #8734298 -
Flags: review?(ekr)
Attachment #8734340 -
Flags: review?(ekr)
Attachment #8734345 -
Flags: review?(ekr)
Comment 10•9 years ago
|
||
Comment on attachment 8734345 [details] [diff] [review]
bug_1259369.diff
Review of attachment 8734345 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM
Attachment #8734345 -
Flags: review?(ekr) → review+
Updated•9 years ago
|
Rank: 45
Priority: -- → P4
Updated•9 years ago
|
Assignee: bogdan.postelnicu → radu.stoica
Status: NEW → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → DUPLICATE
Comment 14•9 years ago
|
||
(In reply to Andi-Bogdan Postelnicu from comment #13)
>
> *** This bug has been marked as a duplicate of bug 1268449 ***
do you want to still land the patch here? The patch from Bug 1268449 seems has landed ?
Keywords: checkin-needed
Updated•9 years ago
|
Flags: needinfo?(radu.stoica)
Comment 15•9 years ago
|
||
No, the patch from bug 1268449 covers it.
You need to log in
before you can comment on or make changes to this bug.
Description
•