gccrs: libproc_macro: Fix literal drop function

Fix drop function by changing the delete operator to delete[] in order
to avoid undefined behaviors.

libgrust/ChangeLog:

	* libproc_macro/literal.cc (Literal::drop): Change
	delete operator to delete[].

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This commit is contained in:
Pierre-Emmanuel Patry 2023-04-21 12:00:08 +02:00 committed by Arthur Cohen
parent 98b779a83c
commit 2698707419

View File

@ -32,11 +32,11 @@ Literal::drop (Literal *lit)
switch (lit->tag)
{
case STRING:
delete lit->payload.string_payload.data;
delete[] lit->payload.string_payload.data;
lit->payload.string_payload.len = 0;
break;
case BYTE_STRING:
delete lit->payload.byte_string_payload.data;
delete[] lit->payload.byte_string_payload.data;
lit->payload.byte_string_payload.size = 0;
break;
case CHAR: