On Sun, Jul 14, 2013 at 1:43 PM, Gagle <[email protected]> wrote: > If we do: > > String::Utf8Value s (String::New ("asdasd")); > > > s can be null if it fails. If this is true then why in the source code they > don't check for null? Examples: L102, L116, etc
Probably whatever reasons it can fail (toString raises an exception) are not possible if the arg is a valid String. > If you look to the above links you can see that after converting the string > they call to strdup() and when they finish with it then they free() it. Why? > Is it necessary? L102/116 are both for loops, when the loop iterates, the Utf8Value probably goes out of scope, so they need a value that will stay in scope. Return values from strdup() need to be freed, or they leak. The code also assumes memory allocation never fails, which is pretty much true nowadays. Also, it doesn't appear to free cwd. Hope that helps. Samm -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
