[netcf-devel] [PATCH 1/2] Windows port - routines patch

Daniel P. Berrange berrange at redhat.com
Mon Nov 8 19:23:48 UTC 2010


On Mon, Nov 08, 2010 at 02:02:06PM -0500, Adam Stokes wrote:
> +
> +char *strerror_r(int errnum, char *buf, size_t buflen) {
> +    return strerror(errnum);
> +}

strerror() is absolutely not threadsafe, so this is dangerous.
Since every other OS went for strerror_r(), Windows decided
to provide strerror_s()  (s for "secure" - no seriously :-)

> + error:
> +    free(adapter);
> +    if(nameDup)
> +        free(nameDup);

free() already checks for NULLs, so the if(nameDup) can be
killed off (likewise anywhere else in the code doing the
same).

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


More information about the netcf-devel mailing list