timecaf/caf.c:1568: use of variable after free

Julien ÉLIE julien at trigofacile.com
Tue Jun 18 17:47:06 UTC 2013

Hi David,

> cppcheck also found this little problem:
> [timecaf/caf.c:1568]: (error) Dereferencing 'newpath' after it is deallocated /  released
> Source code is
>          free(newpath);
>          fclose(infile);
>          unlink(newpath);

Thanks for your report.  It is a real bug, though it should not happen 
often.  This code is triggered when fseeko fails because of a previous 
write that may have failed.

> Suggest put unlink before free.

As the file (whose path is newpath) still has not been created, the fix 
here is to remove the call to unlink.

Julien ÉLIE

« Aliud est celare, aliud tacere. »

More information about the inn-workers mailing list