On Tue, May 9, 2017 at 3:27 PM, Peter J. Philipp <p...@centroid.eu> wrote:
> Sorry the patch is bad because I fail to check what I want to free for NULL. > You probably caught it. Better let someone with lots of experience handle > this. At a cursory glance. Check the referrent.... I believe epp->ep_ndp has an implied lifetime beyond this function, suggested by code comments in the function's description, As the ....makecmds() function's description states it to add commands to the structure pointed by its parameter named epp. So when the call to free() gets Added to the function body, and the code will run; After the ...makecmds() function returns; the Object epp points to should still exist with an epp->ep_ndp member, And ep_ndp->ni_dirp will now point to freed memory just before the ....makecmds() function returns. So instead, there should perhaps be a epp->ep_ndp->ni_dirp = (char*)0; Somewhere in the call path between exec_script_makecmds() And where the state of the program execution is, when you are inspecting the structure to find some errant data. > -peter -- -Jh