changed delete to free for memory allocated using posix_memalign