fix potential NULL-pointer dereference caused by testing the wrong variable after opj_realloc (happens only in OOM situations)