Skip to content

Commit 91a6e57

Browse files
committed
Fixed segmentation fault
1 parent f69ee6f commit 91a6e57

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/options_maker.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ void options_maker(struct options_struct options[], int n_options)
2222
{
2323
int i_opt,i,j;
2424
int max_long_desc=20,non_used_short_opt[200],found;
25+
int max_long_string=150;
26+
2527

2628
for(i_opt=0;i_opt<n_options;i_opt++) {
2729
options[i_opt].long_opt=NULL;
2830
options[i_opt].short_opt=0;
2931
options[i_opt].short_desc=NULL;
30-
for(i=0;i<max_long_desc;i++) strcpy(options[i_opt].long_desc[i],"undef");
32+
/* for(i=0;i<max_long_desc;i++) strcpy(options[i_opt].long_desc[i],"undef"); */
33+
for(i=0;i<max_long_desc;i++) options[i_opt].long_desc[i]=malloc( max_long_string );
3134
options[i_opt].yambo_string="undef";
3235
options[i_opt].bin="all";
3336
options[i_opt].no_bin="none";

0 commit comments

Comments
 (0)