Buggy code:
public class Path extends Resource { public NSBezierPath handle ; public Path ( Device device ) { } public Path ( Device device , Path path , float flatness ) { } public Path ( Device device , PathData data ) { } public void addArc ( float x , float y , float width , float height , float startAngle , float arcAngle ) { } public void addPath ( Path path ) { } public void addRectangle ( float x , float y , float width , float height ) { } public void addString ( String string , float x , float y , Font font ) { } public void close ( ) { } public boolean contains ( float x , float y , GC gc , boolean outline ) { if ( isDisposed ( ) ) SWT . error ( ERROR_GRAPHIC_DISPOSED ) ; if ( gc == null ) SWT . error ( ERROR_NULL_ARGUMENT ) ; if ( gc . isDisposed ( ) ) SWT . error ( ERROR_INVALID_ARGUMENT ) ; NSAutoreleasePool pool = null ; if ( ! ( NSThread . isMainThread ( ) ) ) pool = ( ( NSAutoreleasePool ) ( new NSAutoreleasePool ( ) . alloc ( ) . init ( ) ) ) ; try { if ( outline ) { int pixel = OS . malloc ( 4 ) ; if ( pixel == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; int [ ] buffer = new int [ ] { - 1 } ; OS . memmove ( pixel , buffer , 4 ) ; int colorspace = OS . CGColorSpaceCreateDeviceRGB ( ) ; int context = OS . CGBitmapContextCreate ( pixel , 1 , 1 , 8 , 4 , colorspace , kCGImageAlphaNoneSkipFirst ) ; OS . CGColorSpaceRelease ( colorspace ) ; if ( context == 0 ) { OS . free ( pixel ) ; SWT . error ( ERROR_NO_HANDLES ) ; } GCData data = gc . data ; int capStyle = 0 ; switch ( data . lineCap ) { case SWT . CAP_ROUND : capStyle = OS . kCGLineCapRound ; break ; case SWT . CAP_FLAT : capStyle = OS . kCGLineCapButt ; break ; case SWT . CAP_SQUARE : capStyle = OS . kCGLineCapSquare ; break ; } OS . CGContextSetLineCap ( context , capStyle ) ; int joinStyle = 0 ; switch ( data . lineJoin ) { case SWT . JOIN_MITER : joinStyle = OS . kCGLineJoinMiter ; break ; case SWT . JOIN_ROUND : joinStyle = OS . kCGLineJoinRound ; break ; case SWT . JOIN_BEVEL : joinStyle = OS . kCGLineJoinBevel ; break ; } OS . CGContextSetLineJoin ( context , joinStyle ) ; OS . CGContextSetLineWidth ( context , data . lineWidth ) ; OS . CGContextTranslateCTM ( context , ( ( - x ) + 0.5F ) , ( ( - y ) + 0.5F ) ) ; int path = GC . createCGPathRef ( handle ) ; OS . CGContextAddPath ( context , path ) ; OS . CGPathRelease ( path ) ; OS . CGContextStrokePath ( context ) ; OS . CGContextRelease ( context ) ; OS . memmove ( buffer , pixel , 4 ) ; <START_BUG> OS . malloc ( pixel ) ; <END_BUG> return ( buffer [ 0 ] ) != - 1 ; } else { NSPoint point = new NSPoint ( ) ; point . x = x ; point . y = y ; return handle . containsPoint ( point ) ; } } finally { if ( pool != null ) pool . release ( ) ; } } public void cubicTo ( float cx1 , float cy1 , float cx2 , float cy2 , float x , float y ) { } void destroy ( ) { } public void getBounds ( float [ ] bounds ) { } public void getCurrentPoint ( float [ ] point ) { } public PathData getPathData ( ) { } void init ( PathData data ) { } public boolean isDisposed ( ) { } public void lineTo ( float x , float y ) { } public void moveTo ( float x , float y ) { } public void quadTo ( float cx , float cy , float x , float y ) { } public String toString ( ) { } }

Fix:
OS . free ( pixel ) ;