Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
4769197f
Commit
4769197f
authored
Jan 10, 2014
by
antma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix small memory leak in running_for_first_time (local variable config_directory)
parent
83af542d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
main.c
main.c
+3
-6
No files found.
main.c
View file @
4769197f
...
@@ -143,12 +143,7 @@ char *get_home_directory (void) {
...
@@ -143,12 +143,7 @@ char *get_home_directory (void) {
char
*
get_config_directory
(
void
)
{
char
*
get_config_directory
(
void
)
{
char
*
config_directory
;
char
*
config_directory
;
int
length
=
strlen
(
get_home_directory
())
+
strlen
(
CONFIG_DIRECTORY
)
+
2
;
assert
(
asprintf
(
&
config_directory
,
"%s/"
CONFIG_DIRECTORY
,
get_home_directory
())
>=
0
);
config_directory
=
(
char
*
)
calloc
(
length
,
sizeof
(
char
));
sprintf
(
config_directory
,
"%s/"
CONFIG_DIRECTORY
,
get_home_directory
());
return
config_directory
;
return
config_directory
;
}
}
...
@@ -201,6 +196,8 @@ void running_for_first_time (void) {
...
@@ -201,6 +196,8 @@ void running_for_first_time (void) {
printf
(
"[%s] created
\n
"
,
config_directory
);
printf
(
"[%s] created
\n
"
,
config_directory
);
}
}
free
(
config_directory
);
config_directory
=
NULL
;
// see if config file is there
// see if config file is there
if
(
stat
(
config_filename
,
&
config_file_stat
)
!=
0
)
{
if
(
stat
(
config_filename
,
&
config_file_stat
)
!=
0
)
{
// config file missing, so touch it
// config file missing, so touch it
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment