file: rpc_file_exec_run: fix potential memory leak and integer overflow