On Tue, Nov 28, 2023 at 11:31:48AM -0500, Jason Merrill wrote: > > + if (len) > > + { > > + if (data) > > + msg = c_getstr (data); > > + if (msg == NULL) > > + buf = XNEWVEC (char, len); > > Jonathan pointed out elsewhere that this gets leaked if error return > prevents us from getting to the XDELETEVEC.
Seems it is just one of the returns, so ok to just XDELETEVEC there, or should I add some RAII for that? The other error return after this point is for !len case and so buf isn't allocated. 2023-11-28 Jakub Jelinek <ja...@redhat.com> * semantics.cc (finish_static_assert): Free buf on error return. --- gcc/cp/semantics.cc.jj 2023-11-25 10:28:27.778191561 +0100 +++ gcc/cp/semantics.cc 2023-11-28 18:50:00.094733919 +0100 @@ -11582,6 +11582,7 @@ finish_static_assert (tree condition, tr error_at (location, "%<static_assert%> message %<data()[%d]%> " "must be a constant expression", i); + XDELETEVEC (buf); return; } if (msg == NULL) Jakub