Closed Bug 1117591 Opened 5 years ago Closed 5 years ago

Mismatched alloc/dealloc in APNAudio.cpp

Categories

(Core :: Plug-ins, defect, P5, critical)

ARM
Android
defect

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: njn, Assigned: njn)

References

Details

Attachments

(1 file)

cppcheck says:

> dom/plugins/base/android/ANPAudio.cpp:263: error: Mismatching allocation and deallocation: s
> dom/plugins/base/android/ANPAudio.cpp:271: error: Mismatching allocation and deallocation: s

This was introduced by bug 768000 which change the allocation of |s| from |malloc| to |new| but didn't change the corresponding deallocations from |free| to |delete|.
I'm confident about the two changes in anp_audio_newTrack().

I'm less confident about the change in anp_audio_start() because that function
doesn't appear to be called from our code and so I can't see what gets passed
in... but it makes sense that if we're using |new| to allocate |ANPAudioTrack|
objects in one place we should always use |delete| to deallocate them.
Attachment #8543700 - Flags: review?(blassey.bugs)
Comment on attachment 8543700 [details] [diff] [review]
Fix mismatched alloc/dealloc in APNAudio.cpp

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

I believe the only way a plugin is supposed to construct an ANPAudioTrack is by calling anp_audio_newTrack(), so we're pretty safe here in anp_audio_start().
Attachment #8543700 - Flags: review?(blassey.bugs) → review+
(In reply to Brad Lassey [:blassey] (use needinfo?) from comment #2)
> Comment on attachment 8543700 [details] [diff] [review]
> Fix mismatched alloc/dealloc in APNAudio.cpp
> 
> Review of attachment 8543700 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I believe the only way a plugin is supposed to construct an ANPAudioTrack is
> by calling anp_audio_newTrack(), so we're pretty safe here in
> anp_audio_start().

Correct.
https://hg.mozilla.org/mozilla-central/rev/5667902b8cba
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.