# New Ticket Created by Paul Cochrane # Please include the string: [perl #46253] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=46253 >
Hi, Coverity Prevent tells us in CID 130 that the 'next' variable is checked for nullness *after* it is dereferenced. The offending code is: Instruction * const next = unit->instructions; unit->instructions = tmp; tmp->next = next; next->prev = tmp; --> if 'next' is NULL here (or on following line), tmp->line = next->line; ... kaboom if (!next) --> check if 'next' is NULL unit->last_ins = tmp; The annotations are my reading of the potential problem with the code. Attached is a patch which (I hope) fixes the problem. 'make test' passes so things are mostly ok with the change I've made. The patch definitely needs review as the code isn't very easy to disentangle ('next' updates 'tmp', which later updates 'next', which later updates 'next'...) and so I hope the patch contains the correct logic. If noone complains I'll commit the patch in about 3 days, if it is approved before then, I'll apply it as soon as I can. Thanks! :-) Paul
imcc_instructions_c.patch
Description: Binary data