Fix a small memory leak

... involved in function defining/calling.
Fix passing the "opts" argument to C functions.