Well,

dup and base can be the same pointer.

BR

On Sat, 20 Apr 2019, 11:07 Xavi Artigas, <[email protected]> wrote:

> Hi,
>
> Nobody is freeing what basename returns, right? Or am I reading it wrong?
> (I am not in front of the computer)
>
> Xavi
>
> On Fri, 19 Apr 2019, 5:44 pm Simon Mages via enlightenment-devel, <
> [email protected]> wrote:
>
>> Hi there,
>>
>> i tried to compile efl on a somewhat hardened linux.
>>
>>
>> https://github.com/Enlightenment/efl/blob/master/src/bin/eolian_cxx/eolian_cxx.cc
>>
>> """
>> char* dup = strdup(opts.in_files[0].c_str());
>> char* base = basename(dup);
>> std::string cpp_types_header;
>> opts.unit = (Eolian_Unit*)opts.state;
>> klass = ::eolian_state_class_by_file_get(opts.state, base);
>> free(dup);
>> """
>>
>> basename(3):
>> ...
>> These  functions  may  return pointers to statically allocated memory
>> which may be overwritten by subsequent calls.  Alternatively, they may
>> return a pointer to some part of path, so that the string referred to
>> by path should not be modified or freed until the pointer returned by
>> the function is no longer required.
>> ...
>>
>> As far as i understand the string share structure, this call to free
>> should not be there. Somewhere else in the file there is similar case.
>> Sorry for not sending a diff, but i hope that helps anyway.
>>
>> BR
>> Simon
>>
>>
>> _______________________________________________
>> enlightenment-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>

_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to