#include <stdio.h>
#include <stdlib.h>
static char **g_line_info;
static void sip_selected_init(int32_t line_num) {
const char *temp = locale_info_tr(locale_info(), "Line");
g_line_info = (char **)malloc(sizeof(char *) * line_num);
for (int32_t i = 0; i < line_num; i++) {
char *lin_info = malloc(32);
snprintf(lin_info, 32, "%s%s%d", temp, " ", i + 1);
g_line_info[i] = lin_info;
}
}
static void sip_selected_deinit(int32_t line_num) {
for (int32_t i = 0; i < line_num; i++) {
free(g_line_info[i]);
g_line_info[i] = NULL;
}
free(g_line_info);
g_line_info = NULL;
}
int main() {
sip_selected_init(1);
sip_selected_deinit(1);
// 其他代码...
return 0;
}
以上代码,为什么不用释放line_info