ljpegenc: allocate needed scratch-buffer

Fixes null pointer dereference
Fixes Ticket2207

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>