Closed Bug 40529 Opened 24 years ago Closed 24 years ago

Some error returns in PR_GetIPNodeByName don't properly clean up

Categories

(NSPR :: NSPR, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

Attachments

(1 file)

In prnetdb.c, PR_GetIPNodeByName, some error returns
in the #if defined(_PR_INET6) && defined(_PR_HAVE_GETHOSTBYNAME2)
block towards the end of the function (which appends
the IPv4 addresses to the end of the addr list) don't
properly clean up.

Specifically, at the two places where Alloc() fails,
the function just returns PR_FAILURE.  It does not
set the error code, and it does not unlock the dns
lock.  This can be fixed by moving that block of code
to a different function and having PR_GetIPNodeByName
call this new function.

Another problem is that we don't need to execute
that piece of code if the CopyHostent() call fails.
Attached patch Proposed patch.Splinter Review
Checked in the fix on the main trunk.
/cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c, revision 3.16
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: