Closed Bug 1250499 Opened 9 years ago Closed 9 years ago

[Static Analysis][Resource Leak] In function mount_operation_ask_password

Categories

(Core :: Networking: Cookies, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: radu.stoica, Assigned: radu.stoica)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 749197[necko-active])

Attachments

(1 file, 3 obsolete files)

The Static Analysis tool Coverity added \ possible Resource leak (RESOURCE_LEAK)
Attached patch bug_1250499.diff (obsolete) — Splinter Review
Attachment #8722507 - Flags: review?(mconnor)
Attachment #8722507 - Flags: review?(ehsan)
Comment on attachment 8722507 [details] [diff] [review] bug_1250499.diff Review of attachment 8722507 [details] [diff] [review]: ----------------------------------------------------------------- ::: extensions/gio/nsGIOProtocolHandler.cpp @@ +867,5 @@ > &pass, &retval); > } > if (NS_FAILED(rv) || !retval) { // was || user == '\0' || pass == '\0' > g_mount_operation_reply(mount_op, G_MOUNT_OPERATION_ABORTED); > + free(user); You're still leaking pass with this patch. You need to free them both here.
Attachment #8722507 - Flags: review?(mconnor)
Attachment #8722507 - Flags: review?(ehsan)
Attachment #8722507 - Flags: review-
Attached patch bug_1250499.diff (obsolete) — Splinter Review
Attachment #8722955 - Flags: review?(ehsan)
Comment on attachment 8722955 [details] [diff] [review] bug_1250499.diff Review of attachment 8722955 [details] [diff] [review]: ----------------------------------------------------------------- ::: extensions/gio/nsGIOProtocolHandler.cpp @@ +874,5 @@ > + } > + if (pass) { > + free(pass); > + pass = nullptr; > + } free() can deal with a nullptr being passed to it, also since you're returning there is no point in resetting these variables to nullptr since they're on the stack. I think it's enough to just free them both.
Attachment #8722955 - Flags: review?(ehsan)
Attached patch bug_1250499.diff (obsolete) — Splinter Review
ok, i've modified it
Attachment #8723523 - Flags: review?(ehsan)
Comment on attachment 8723523 [details] [diff] [review] bug_1250499.diff Review of attachment 8723523 [details] [diff] [review]: ----------------------------------------------------------------- Thank you! r=me
Attachment #8723523 - Flags: review?(ehsan) → review+
Whiteboard: CID 749197 → CID 749197[necko-active]
Keywords: checkin-needed
Keywords: checkin-needed
Summary: [Static Analysis] - possible Resource leak → [Static Analysis][Resource Leak] In function mount_operation_ask_password
Attached patch bug_1250499.diffSplinter Review
Attachment #8722507 - Attachment is obsolete: true
Attachment #8722955 - Attachment is obsolete: true
Attachment #8723523 - Attachment is obsolete: true
Keywords: checkin-needed
Dear sheriffs: this can be landed without a try run. Thanks!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: