freebsd-ports/x11-toolkits/swt/files/extra-patch-i386-os.c
Edwin Groothuis a991ef1bdd [MAINTAINER] x11-toolkits/swt: Update to 3.3 Release
Update to 3.3 Release.

PR:		ports/116845
Submitted by:	Robert Noland <rnoland@2hip.net>
2007-10-03 03:30:06 +00:00

20 lines
848 B
C

--- os.c.orig 2007-04-26 14:03:00.000000000 -0400
+++ os.c 2007-08-10 11:56:22.000000000 -0400
@@ -17397,11 +17397,16 @@
jint rc = 0;
OS_NATIVE_ENTER(env, that, realpath_FUNC);
if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
- if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg1) {
+ if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ } else
+ lparg1 = malloc(PATH_MAX);
rc = (jint)realpath((const char *)lparg0, (char *)lparg1);
fail:
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ if (!arg1 && lparg1 && rc == 0)
+ free(lparg1);
OS_NATIVE_EXIT(env, that, realpath_FUNC);
return rc;
}