Segfault and compilation error on OSX10.9 and FreeBSD 10 with clang

This fixes a compilation error (malloc comes with stdlib.h on freebsd10 and macosx) and there's a suggested fix for a segmentation fault on FreeBSD and MacOSX (using clang). I've made it allocate on the heap instead, don't think it will matter much for performance since it only seems to allocate it once per work unit. 

Here's some debugger output
```
Process 42966 stopped
* thread #2: tid = 0x158b9e, 0x00007fff90a7cc7a libsystem_platform.dylib`_platform_memmove$VARIANT$Unknown + 378, stop reason = EXC_BAD_ACCESS (code=2, address=0x100506000)
    frame #0: 0x00007fff90a7cc7a libsystem_platform.dylib`_platform_memmove$VARIANT$Unknown + 378
libsystem_platform.dylib`_platform_memmove$VARIANT$Unknown + 378:
-> 0x7fff90a7cc7a:  vmovups %ymm4, 0x60(%rdi,%rdx)
   0x7fff90a7cc80:  popq   %rbp
   0x7fff90a7cc81:  vzeroupper 
   0x7fff90a7cc84:  ret    
(lldb) up
frame #1: 0x00007fff93adbd75 libsystem_c.dylib`__memcpy_chk + 22
libsystem_c.dylib`__memcpy_chk + 22:
-> 0x7fff93adbd75:  movq   %rbx, %rax
   0x7fff93adbd78:  addq   $0x8, %rsp
   0x7fff93adbd7c:  popq   %rbx
   0x7fff93adbd7d:  popq   %rbp
(lldb) up
frame #2: 0x0000000100021672 minerd`cryptonight_hash_ctx_aes_ni(output=0x000000010068cc20, input=0x000000010068ce18, len=76, ctx=0x000000010048ca88) + 610 at cryptonight.c:217
   214 	        RND(5);
   215 	        RND(6);
   216 	        RND(7);
-> 217 	        memcpy(&ctx->long_state[i], ctx->text, INIT_SIZE_BYTE);
   218 	    }
   219 	
   220 	    xor_blocks_dst(&ctx->state.k[0], &ctx->state.k[32], ctx->a);
(lldb) frame variable
(void *) output = 0x000000010068cc20
(const void *) input = 0x000000010068ce18
(size_t) len = 76
(cryptonight_ctx *) ctx = 0x000000010048ca88
(size_t) i = 496896 <-- seems to always stop on this number (up to 497016 actually allocated here, but should be 2097151)
(size_t) j = 0
```