Fixed memory leak in r_core_anal_fcn()

In certain situations the function would return early after an error
occurred without freeing the next array first, thus leading to a leak.