Closed Bug 487018 Opened 15 years ago Closed 15 years ago

Allocator mismatches in libjar

Categories

(Core :: Networking: JAR, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file, 2 obsolete files)

* In nsWildCard/nsZipFind, the pattern is created using PL_strdup but freed (in several places) using PR_Free
* In nsJARManifestItem the string created by CalculatedDigest using ToNewCString is freed in several places using PR_FREEIF
Attached patch Basic patch (obsolete) — Splinter Review
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #371215 - Flags: superreview?(dveditz)
Attachment #371215 - Flags: review?(timeless)
Actually nsWildCard and nsZipFind are separate allocations.
Attached patch Typo fix (obsolete) — Splinter Review
Attachment #371215 - Attachment is obsolete: true
Attachment #371217 - Flags: superreview?(dveditz)
Attachment #371217 - Flags: review?(timeless)
Attachment #371215 - Flags: superreview?(dveditz)
Attachment #371215 - Flags: review?(timeless)
Switching to nsCString reduces the amount of memory management necessary.
Attachment #371219 - Flags: superreview?(dveditz)
Attachment #371219 - Flags: review?(timeless)
Attachment #371219 - Flags: review?(timeless) → review+
Comment on attachment 371219 [details] [diff] [review]
Avoid manual memory management

>+++ b/modules/libjar/nsZipArchive.cpp	Mon Apr 06 11:57:36 2009 +0100
>@@ -740,17 +740,18 @@ nsZipArchive::FindInit(const char * aPat
>   if (!*aFind) {
>-    PR_FREEIF(pattern);
>+    if (pattern)
>+      PL_strfree(pattern);

It should be safe to pass null to PL_strfree()

>-  PR_FREEIF(mPattern);
>+  if (mPattern)
>+    PL_strfree(mPattern);

ditto.

sr=dveditz
Attachment #371219 - Flags: superreview?(dveditz) → superreview+
Comment on attachment 371217 [details] [diff] [review]
Typo fix

This appears to be obsoleted by attachment 371219 [details] [diff] [review].
Attachment #371217 - Attachment is obsolete: true
Attachment #371217 - Flags: superreview?(dveditz)
Attachment #371217 - Flags: review?(timeless)
Pushed changeset 1fd2edfa2d49 to mozilla-central.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: