fix curl memory leak