Closed Bug 1183781 Opened 9 years ago Closed 7 years ago

Small leak in DNS.cpp and nsHostResolver.cpp

Categories

(Core :: Networking: DNS, defect, P2)

41 Branch
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: valentin, Assigned: valentin)

References

Details

(Whiteboard: [necko-next])

Attachments

(3 files)

Attachment #8634059 - Flags: review?(sworkman)
Assignee: nobody → valentin.gosu
Status: NEW → ASSIGNED
Comment on attachment 8634059 [details] [diff] [review]
i - Fix leak in nsHostResolver

Review of attachment 8634059 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks Valentin. r=me with some nits.

Per our IRC chat, please file a new bug to convert these raw pointers to nsAutoPtr or something like that.

::: netwerk/dns/nsHostResolver.cpp
@@ +863,5 @@
>                               LOG_HOST(host, netInterface),
>                               (af == PR_AF_INET) ? "AF_INET" : "AF_INET6"));
>  
> +                        if (he->rec->addr_info) {
> +                            // prevent leak

Put the comment before the if block and change to...

// Ensure existing |addr_info| in |he| is cleared before copying from |unSpecHe|.

@@ +870,1 @@
>                          he->rec->addr_info = nullptr;

Please put the "= nullptr" in the if block.
Attachment #8634059 - Flags: review?(sworkman) → review+
Blocks: 1185120
https://hg.mozilla.org/mozilla-central/rev/60d045b1c1a6
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Backed out at KaiRo's request for causing bug 1186435.
https://hg.mozilla.org/mozilla-central/rev/2ddec2dedced
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla42 → ---
Depends on: 1186435
* makes AddrInfo extend nsISupports
* uses RefPtr for managing AddrInfo and nsHostResolver in nsHostResolver.cpp
Attachment #8689496 - Flags: review?(sworkman)
Blocks: 1189430
Comment on attachment 8689496 [details] [diff] [review]
Small leak in DNS.cpp and nsHostResolver.cpp

Review of attachment 8689496 [details] [diff] [review]:
-----------------------------------------------------------------

LGTM - couple of really minor style nits. r=me.

::: netwerk/dns/GetAddrInfo.cpp
@@ +362,5 @@
>    }
>  
>    bool filterNameCollision = !(aFlags & nsHostResolver::RES_ALLOW_NAME_COLLISION);
> +  RefPtr<AddrInfo> ai(new AddrInfo(aCanonHost, prai, disableIPv4,
> +                      filterNameCollision, canonName));

nit: filterNameCollision should align with aCanonHost on the line above since they're both in the list of params in AddrInfo's constructor.

::: netwerk/dns/nsHostResolver.cpp
@@ +1244,5 @@
>  
>          rec->negative = !rec->addr_info;
>          PrepareRecordExpiration(rec);
>          rec->resolving = false;
>          

nit: Can you remove this whitespace while you're updating the code please?
Attachment #8689496 - Flags: review?(sworkman) → review+
https://hg.mozilla.org/mozilla-central/rev/b9b6a1567ef6
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
The leak still exists since we backed out the patch fixing this about 3 times already.
I'm currently investigating it.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [necko-active]
Target Milestone: mozilla45 → ---
Whiteboard: [necko-active] → [necko-next]
See Also: → 1336170
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P2
The leak was fixed a while ago, and it is no longer triggered in automation.
I'll open a new bug for converting the pointers to smart pointers.
Status: REOPENED → RESOLVED
Closed: 9 years ago7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: