Closed
Bug 1167249
Opened 10 years ago
Closed 10 years ago
ssltunnel.cpp:1321:9: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
Categories
(Testing :: Mochitest, defect)
Testing
Mochitest
Tracking
(firefox41 fixed)
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
1.47 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
New build warnings, when compiling mozilla-inbound with clang 3.7:
{
5:25.78 Warning: -Wmismatched-new-delete in /scratch/work/builds/mozilla-inbound/mozilla/testing/mochitest/ssltunnel/ssltunnel.cpp: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?
5:25.78 /scratch/work/builds/mozilla-inbound/mozilla/testing/mochitest/ssltunnel/ssltunnel.cpp:1321:9: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
5:25.78 delete hostname_copy;
5:25.78 ^
5:25.78 []
5:25.78 /scratch/work/builds/mozilla-inbound/mozilla/testing/mochitest/ssltunnel/ssltunnel.cpp:1306:29: note: allocated with 'new[]' here
5:25.78 char *hostname_copy = new char[strlen(hostname)+strlen(hostportstring)+2];
5:25.78 ^
5:25.79 Warning: -Wmismatched-new-delete in /scratch/work/builds/mozilla-inbound/mozilla/testing/mochitest/ssltunnel/ssltunnel.cpp: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'?
5:25.79 /scratch/work/builds/mozilla-inbound/mozilla/testing/mochitest/ssltunnel/ssltunnel.cpp:1322:9: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
5:25.79 delete redir_copy;
5:25.79 ^
5:25.79 []
5:25.79 /scratch/work/builds/mozilla-inbound/mozilla/testing/mochitest/ssltunnel/ssltunnel.cpp:1316:26: note: allocated with 'new[]' here
5:25.79 char *redir_copy = new char[strlen(redirhoststring)+1];
5:25.79 ^
}
Looks like these delete statements were introduced in
https://hg.mozilla.org/integration/mozilla-inbound/rev/c4bab6f234f6
Assignee | ||
Comment 1•10 years ago
|
||
Ryan, would you mind taking this? I think we just need to convert these delete statements (for hostname_copy and redir_copy) to use "delete[]"?
Flags: needinfo?(nathmatics)
Assignee | ||
Comment 2•10 years ago
|
||
Actually, I'll just take this, since it's trivial and I'm not sure if other compilers warn about this clearly.
Assignee: nobody → dholbert
Flags: needinfo?(nathmatics)
Assignee | ||
Comment 3•10 years ago
|
||
Attachment #8608809 -
Flags: review?(ted)
Assignee | ||
Comment 4•10 years ago
|
||
Updated the fix to have more lines of context, so you can see the "new" statements that do the allocation for these variables. (to verify that it's really new[])
Attachment #8608809 -
Attachment is obsolete: true
Attachment #8608809 -
Flags: review?(ted)
Attachment #8608812 -
Flags: review?(ted)
Comment 5•10 years ago
|
||
Daniel, looks like my compiler didn't pick this warning up. Sorry about that!
Assignee | ||
Comment 6•10 years ago
|
||
No worries -- delete/delete[] is an easy mistake to make (and I think it might only be a warning in newer compiler versions, maybe only clang 3.7).
(I also filed Bug 1167250 will make us treat build warnings in this directory as errors from now on, to make issues like this more likely to be caught.)
Assignee | ||
Comment 7•10 years ago
|
||
Green try run (with Bug 1167250 layered on top, as well):
https://treeherder.mozilla.org/#/jobs?repo=try&revision=601de87bfb88
Updated•10 years ago
|
Attachment #8608812 -
Flags: review?(ted) → review+
Comment 9•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•