fixed prototype memory leak

protolib_add_prototype() makes a copy of the prototype, so allocating a new
pointer there was an error
fixed memory leaks

Two leaks plugged:

1. value used for array-length
2. prototype return type