Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe949fd

Browse files
committed
fix memory leak in config_get_opt
1 parent0e1227b commitbe949fd

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

‎src/utils/configuration.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,9 @@ config_get_opt(int argc, char **argv, ConfigOption cmd_options[],
538538
assign_option(opt,optarg,SOURCE_CMD);
539539
}
540540

541+
pgut_free(optstring);
542+
pgut_free(longopts);
543+
541544
returnoptind;
542545
}
543546

‎src/utils/pgut.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,12 @@ pgut_str_strip_trailing_filename(const char *filepath, const char *filename)
993993
returnpgut_strndup(filepath,fp_len);
994994
}
995995

996+
void
997+
pgut_free(void*p)
998+
{
999+
free(p);
1000+
}
1001+
9961002
FILE*
9971003
pgut_fopen(constchar*path,constchar*mode,boolmissing_ok)
9981004
{

‎src/utils/pgut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extern void *pgut_realloc(void *p, size_t size);
6464
externchar*pgut_strdup(constchar*str);
6565
externchar*pgut_strndup(constchar*str,size_tn);
6666
externchar*pgut_str_strip_trailing_filename(constchar*filepath,constchar*filename);
67+
externvoidpgut_free(void*p);
6768

6869
#definepgut_new(type)((type *) pgut_malloc(sizeof(type)))
6970
#definepgut_new0(type)((type *) pgut_malloc0(sizeof(type)))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp