Of course, I made a (harmless) mistake in xstrdup. There is no need to throw since NEW does that already.
+static char* +xstrdup(JNIEnv *env, const char *s) +{ + size_t size = strlen(s) + 1; + char *p = NEW(char, size); + if (p != NULL) + memcpy(p, s, size); + return p; +} + On Tue, Mar 26, 2013 at 6:58 PM, Christos Zoulas <chris...@zoulas.com>wrote: > On Mar 26, 6:13pm, marti...@google.com (Martin Buchholz) wrote:LGTM, > only question is why error from one allocation throws and from the > other does not? I would move the throw after the: > > if (splitpath == NULL || pathv == NULL) { > > The rule is: failed allocation throws, caller needs to check for and propagate NULL. > This way we don't need to pass env to xstrdup(). Now you are going to make > me grep on how many xstrdup()'s are in the tree :-) >