修复专用机接口的内存泄露问题
This commit is contained in:
parent
5e12794eed
commit
fc3b66a302
|
@ -11,8 +11,8 @@ static char* get_val_from_file(FILE *fp, const char *key)
|
|||
{
|
||||
if (! fp)
|
||||
return NULL;
|
||||
char *val;
|
||||
char buf[1024];
|
||||
char *val = NULL;
|
||||
char buf[1024] = {0};
|
||||
while (fgets(buf, 1024, fp))
|
||||
{
|
||||
if (strncmp(buf, key, strlen(key)) == 0)
|
||||
|
@ -368,17 +368,23 @@ char* kdk_system_get_currentUser()
|
|||
bool kdk_system_is_zyj(void)
|
||||
{
|
||||
char *project_codename = NULL;
|
||||
bool bool_value = FALSE;
|
||||
FILE *fp = fopen("/etc/os-release", "r");
|
||||
if (!fp)
|
||||
return FALSE;
|
||||
|
||||
return bool_value;
|
||||
|
||||
project_codename = get_val_from_file(fp, "PROJECT_CODENAME");
|
||||
|
||||
if (strstr(project_codename, "zyj") ||strstr(project_codename, "ZYJ") )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
return FALSE;
|
||||
if (project_codename && (strstr(project_codename, "zyj") || strstr(project_codename, "ZYJ")) )
|
||||
|
||||
bool_value = TRUE;
|
||||
else
|
||||
bool_value = FALSE;
|
||||
|
||||
|
||||
exit:
|
||||
fclose(fp);
|
||||
if(project_codename)
|
||||
free(project_codename);
|
||||
return bool_value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue