# New Ticket Created by Paul Cochrane
# Please include the string: [perl #44967]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44967 >
While having a look through some of the static analysis output
provided by Coverity Prevent I stumbled across this code (in
compilers/imcc/optimizer.c:633):
if (found) {
prev = ins2->prev;
if (prev) {
subst_ins(unit, ins2, tmp, 1);
any = 1;
IMCC_debug(interp, DEBUG_OPT2,
" reduced to %I\n", tmp);
ins2 = prev->next;
}
}
The variable ins2 is freed by the call to subst_ins() but is then
later assigned to later in the if-block. Um, this isn't a good idea
is it? The variable shouldn't be freed in subst_ins() I don't think,
so shouldn't we instead have the line:
subst_ins(unit, ins2, tmp, 0);
(where setting the argument to 0 means *not* freeing the variable).
Is this the right thing to do? Just wanted to ask the opinion of our
resident gurus before I went and broke something...
Thanks!
Paul