Closed Bug 1317229 Opened 3 years ago Closed 3 years ago

CID 1394329: (DELETE_ARRAY) delete [] Array instead of delete Array in TestAudioSegment.cpp

Categories

(Core :: WebRTC: Audio/Video, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1317221

People

(Reporter: JamesCheng, Assigned: JamesCheng)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: [CID 1394329])

Attachments

(1 file)

http://searchfox.org/mozilla-central/rev/4b6cab91f93c73ae591dafaea40fd5704b41810e/dom/media/gtest/TestAudioSegment.cpp#214,216-217,237-238

Need to fix the code into 

delete [] output[0];
delete [] output;

since they are arrays.

It is weird that the treeherder did not show any run time error about this.
See Also: → 1317221
Keywords: coverity
Whiteboard: [CID 1394329]
> It is weird that the treeherder did not show any run time error about this.

Although new/delete mismatches can cause problems, in practice they often don't.
But I can reproduce the run time error easily by just a simple code as below

#include <iostream>
using namespace std;
class Foo
{
public:
	Foo(){}
	~Foo(){ cout<<"destructor"<<endl;}
};
int main() {
	Foo *ptr = new Foo[1];
	delete ptr;
	return 0;
}

That's why I'm surprised that the test code didn't bump into error.
Rank: 35
Priority: -- → P3
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1317221
You need to log in before you can comment on or make changes to this bug.