Fix potential memleaks in mexFunction
Fix potential memleaks in mexFunction

AMICI-developer/AMICI,FFroehlich/AMICI,FFroehlich/AMICI,AMICI-developer/AMICI,FFroehlich/AMICI,AMICI-developer/AMICI,FFroehlich/AMICI,AMICI-developer/AMICI