use cdb_free to prevent buffer leak