Re: [PATCH] clients/terminal: check for asprintf error condition instead

2014-05-15 Thread Pekka Paalanen
On Thu, 15 May 2014 13:36:12 -0700 "U. Artie Eoff" wrote: > asprintf returns -1 if memory allocation fails and that's what > we're really protecting here. So check for -1 instead of > 0 > result. > > In general, when asprintf returns 0, then the memory allocation > succeeded, but no bytes printe

[PATCH] clients/terminal: check for asprintf error condition instead

2014-05-15 Thread U. Artie Eoff
asprintf returns -1 if memory allocation fails and that's what we're really protecting here. So check for -1 instead of > 0 result. In general, when asprintf returns 0, then the memory allocation succeeded, but no bytes printed. If we only free the allocated memory when the result is > 0, then we