The pointer returned in retbuf is valid until a new mi_exec() function is run or until the statement is dropped via mi_drop_prepared_statement(). If you need to save the data for later use, copy the data to which retbuf points into a variable that you have defined.