* handling cleanup attributes with a goto
@ 2026-06-03 8:41 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-06-03 8:41 UTC (permalink / raw)
To: linux-sparse
If you have code like:
for (i = 0; i < 10; i++) {
struct foo *buf __free(kfree) = NULL;
if (frob())
goto one;
one:
blah(); blah(); blah();
if (frob())
goto two;
}
two:
blah(); blah(); blah();
The goto one won't free the buf because the label is inside the block
but the goto two will because it's outside.
At first I thought I could get the scope that the label is in from
the stmt->goto_label->label_scope but that's scope where the goto
can be and not where the label is. Is there a way to get the
information about the scope where the label is?
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-03 8:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 8:41 handling cleanup attributes with a goto Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox