@@ -207,9 +207,9 @@ qf_init_ext(
207207 char_u * fmtstr = NULL ;
208208 char_u * growbuf = NULL ;
209209 int growbuflen ;
210- int growbufsiz ;
211- char_u * linebuf ;
212- int linelen ;
210+ int growbufsiz = 0 ;
211+ char_u * linebuf = NULL ;
212+ int linelen = 0 ;
213213 int discard ;
214214 int col = 0 ;
215215 char_u use_viscol = FALSE;
@@ -545,12 +545,12 @@ qf_init_ext(
545545 linelen = len > LINE_MAXLEN ? LINE_MAXLEN - 1 : len ;
546546 if (growbuf == NULL )
547547 {
548- growbuf = alloc (linelen );
548+ growbuf = alloc (linelen + 1 );
549549 growbufsiz = linelen ;
550550 }
551551 else if (linelen > growbufsiz )
552552 {
553- growbuf = vim_realloc (growbuf , linelen );
553+ growbuf = vim_realloc (growbuf , linelen + 1 );
554554 if (growbuf == NULL )
555555 goto qf_init_end ;
556556 growbufsiz = linelen ;
@@ -589,13 +589,13 @@ qf_init_ext(
589589 linelen = LINE_MAXLEN - 1 ;
590590 if (growbuf == NULL )
591591 {
592- growbuf = alloc (linelen );
592+ growbuf = alloc (linelen + 1 );
593593 growbufsiz = linelen ;
594594 }
595595 else if (linelen > growbufsiz )
596596 {
597597 if ((growbuf = vim_realloc (growbuf ,
598- linelen )) == NULL )
598+ linelen + 1 )) == NULL )
599599 goto qf_init_end ;
600600 growbufsiz = linelen ;
601601 }
@@ -623,14 +623,14 @@ qf_init_ext(
623623 {
624624 if (growbuf == NULL )
625625 {
626- growbuf = alloc (linelen );
626+ growbuf = alloc (linelen + 1 );
627627 growbufsiz = linelen ;
628628 }
629629 else if (linelen > growbufsiz )
630630 {
631631 if (linelen > LINE_MAXLEN )
632632 linelen = LINE_MAXLEN - 1 ;
633- if ((growbuf = vim_realloc (growbuf , linelen )) == NULL )
633+ if ((growbuf = vim_realloc (growbuf , linelen + 1 )) == NULL )
634634 goto qf_init_end ;
635635 growbufsiz = linelen ;
636636 }
0 commit comments