Pino Toscano, le Mon 16 Apr 2012 22:51:01 +0200, a écrit :
> ... but then you leak readLinkBuffer in both the cases (error return
> value from readlink(), and success); you can do something like this:
> 
> | CString resultString;
> | if (result >= 0 && result < sb.st_size)
> |   resultString = CString(readLinkBuffer, result);
> | free(readLinkBuffer);
> | return resultString;

Ah, CString returns a new object, not a trivial object pointing at the
buffer? Then yes, it can simply be freed that way indeed.

Samuel


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to