[PATCH 4/6] added openconnect_strdup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 26, 2014 at 3:13 PM, David Woodhouse <dwmw2 at infradead.org> wrote:

>> I think that's too much of a complexity, for such an issue. That could
>> also very easily break in a rewrite of internal part of libopenconnect
>> and would result in hard to find issues. Would it make sense to
>> introduce new entry functions that will simply allocate the data they
>> need? That would solve the issue, and will not require tracking each
>> and every variable used internally.
> But don't we already *have* entry functions in library.c for almost all
> cases where this is an issue? Where the original code used to just set
> variables such as vpninfo->host directly, we added functions like
> openconnect_set_hostname() to library.c.

I meant to add openconnect_set_hostname_const() which will simply
strdup() its input and avoid messing with the caller's memory at all.

> So if we just make all the functions in library.c do an appropriate
> strdup() + free_func() to 'internalise' the string, isn't that 99% of
> the job? There are a couple of cases where it *isn't* in library.c IIRC,
> but certainly we shouldn't need to worry about future rewrites of
> internal code, if we do it on the way *in*.

So you suggest adding an openconnect_set_user_free(), which will be
used by openconnect_set_hostname() and friends? I don't like it much,
but it requires less changes and it would work too.

regards,
Nikos



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux