This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] avoid relying on getcwd extensions (PR 80047)


On 03/15/2017 02:29 PM, Martin Sebor wrote:
PR 80047 - fixincludes/fixincl.c: PVS-Studio: Improper Release
of Memory Before Removing Last Reference (CWE-401) points out
that the fixincludes program calls getcwd with the first argument
set to NULL, apparently a Glibc extension, to have the function
allocate the memory to which it then returns a pointer.

The attached patch avoids this and also avoids assuming the
function cannot fail.

This is not a regression so I assume it's not suitable for
GCC 7 but rather for GCC 8 when stage 1 opens.
OK for gcc-8.
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]