Memory leak: malloc never released. Is replaced by: alloca

Or add free(..) to the end.