Arjen de Korte
2010-Feb-19 15:52 UTC
[Nut-upsdev] [nut-commits] svn commit r2360 - trunk/clients
Citeren Arjen de Korte <adkorte-guest op alioth.debian.org>:> Author: adkorte-guest > Date: Fri Feb 19 13:22:12 2010 > New Revision: 2360 > URL: http://boxster.ghz.cc/projects/nut/changeset/2360 > > Log: > You can't compare strings with '!=' in C, so the logic to determine > if the stock message was overridden was flawed (causing problems > with (de)allocation of memory) > > Modified: > trunk/clients/upsmon.c > trunk/clients/upsmon.hThe above isn't true if we only compare if we only look if the pointer address we assigned previously hasn't changed (and this is what we did before). Nevertheless, I really dislike the prior way of checking for changes and would rather see that pointers that are used for dynamic memory are initialized to NULL and free'd unconditionally before allocating memory to them. This makes it much easier to prevent leaking memory. Best regards, Arjen -- Please keep list traffic on the list