remove use of stdlib free