C language malloc release

problem description

use malloc to apply for space in a function in a C language project. Finally, the function returns the value saved in this space, that is, there is no space requested by free in the function, so do you need free outside the function?

related codes

char *test() {
    char *op = malloc(sizeof(char) * 16);
    ...
    return op;
 }
 
 int main() {
     printf("%s", test());
 }
CPP c
Oct.30,2021

needs to be released manually
malloc and free need to be used in pairs, otherwise it is easy to cause memory leak

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b4d9-e7d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b4d9-e7d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?