[PATCH] Terminate decode at end of string and fix mem leak
Dirk Hohndel
dirk at hohndel.org
Sun Mar 17 14:57:44 PDT 2013
Miika Turkia <miika.turkia at gmail.com> writes:
>> why remove the const?
>
> We need to free the allocated string, thus I thought working without
> const would be better than typecasting const char * to char * on the
> free.
Well, the const can be useful to find bugs - the cast when calling free
is annoying but harmless (IMHO). We have that in many places in the
code.
>> I'm missing the point why this is better (and I dislike the asymetric "}
>> else" -- if you one side has curly braces, the other one should, too...
>
> We need to free the res only if the process_divelog_de function
> allocates new buffer for it. I have attached a different version that
> does this by type casting if you prefer that.
I like the new patch MUCH better. Much smaller, cleaner, easier.
Thanks. Pushed.
/D
More information about the subsurface
mailing list