Closed Bug 1021142 Opened 5 years ago Closed 5 years ago

refresh_product_info_block leaks file handle on failure

Categories

(Toolkit :: Application Update, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: mccr8, Assigned: shashank, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak, Whiteboard: [CID 1123276] )

Attachments

(1 file)

fp = fopen(path, "r+b");
  ...
    if (fread(&additionalBlockSize, 
              sizeof(additionalBlockSize), 
              1, fp) != 1) {
      // fp isn't closed
      return -1;
    }
  ...
    if (fread(&additionalBlockID, 
              sizeof(additionalBlockID), 
              1, fp) != 1) {
      // fp isn't closed
      return -1;
    }
Can you provide a DXR link to that, and I'll shop it around?
Whiteboard: [CID 1123276] → [CID 1123276] [mentor=mccr8]
Mentor: continuation
Whiteboard: [CID 1123276] [mentor=mccr8] → [CID 1123276]
Do two simple 'fclose(fp)' statements suffice?
Yes, I think so.
Comment on attachment 8479512 [details] [diff] [review]
BUG 1021142 - 'fclose()' at 2 places to avoid leaks on failure r=mccr8

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

Is this something you could review, Brian?  Thanks.
Attachment #8479512 - Flags: review?(continuation) → review?(netzen)
Comment on attachment 8479512 [details] [diff] [review]
BUG 1021142 - 'fclose()' at 2 places to avoid leaks on failure r=mccr8

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

Sorry for the delay and thanks for the patch!
Attachment #8479512 - Flags: review?(netzen) → review+
I'll do a try run later today.
Assignee: nobody → shashank
Flags: needinfo?(continuation)
Try looks good.  Thanks for the patch!
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/af568e909c62
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.