Suppose I write a user defined function that basically just declares and populates a blob e.g. char *blob=(char*)malloc(50); // populate blob should I end the function sqlite3_result_blob(ctx,blob,50,SQLITE_TRANSIENT); free(blob); or sqlite3_result_blob(ctx,blob,50,free); While the latter would save sqlite having to create a copy of the blob I'm a bit worried about the function being called multiple times in the same sql statement e.g. select fct(..), fct(..), fct(..), fct(..), fct(..); and the frees building up. Am I worrying about nothing? Also, is the use of SQLITE_TRANSIENT a necessity if the memory will be automatically freed at the end of the function? e.g. in the case of char blob[50]={...};