== Why is this an issue?

Memory that is allocated with ``++new T[n]++`` _must_ be freed with ``++delete[]++``. Leave out the ``++[]++``, and the likely result is heap corruption or, as a best-case scenario, premature program termination.


=== Noncompliant code example

[source,cpp]
----
char *cp = new char[10];
// ...
delete cp;  // Noncompliant
----


=== Compliant solution

[source,cpp]
----
char *cp = new char[10];
// ...
delete[] cp; 
----



ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

=== duplicates: S1232

=== on 10 Mar 2016, 22:29:47 Evgeny Mandrikov wrote:
Looks like duplicate of RSPEC-1232

=== on 11 Mar 2016, 08:31:55 Ann Campbell wrote:
Thanks [~evgeny.mandrikov], you're right.

endif::env-github,rspecator-view[]
