Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FTL v2.6.2 #32

Merged
merged 3 commits into from
May 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions setupVars.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ char * read_setupVarsconf(const char * key)

// Key not found -> return NULL
fclose(setupVarsfp);

// setting unused pointers to NULL
// protecting against dangling pointer bugs
free(keystr);
keystr = NULL;
free(linebuffer);
linebuffer = NULL;
return NULL;
}

Expand Down Expand Up @@ -112,12 +117,19 @@ void getSetupVarsArray(char * input)
void clearSetupVarsArray(void)
{
setupVarsElements = 0;
free(setupVarsArray);
free(linebuffer);
// setting unused pointers to NULL
// protecting against dangling pointer bugs
setupVarsArray = NULL;
linebuffer = NULL;
// free only if not already NULL
if(setupVarsArray != NULL)
{
free(setupVarsArray);
setupVarsArray = NULL;
}
if(linebuffer != NULL)
{
free(linebuffer);
linebuffer = NULL;
}
}

/* Example
Expand Down