removing extra malloc