I also see this warning, and I am not sure that setting it to zero would be
best.
Perhaps setting it to -1 if the call to vim_strsave(curbuf->b_p_inde) fails?
Patch:
diff --git a/src/misc1.c b/src/misc1.c
index 1a220e1eb..6bd80a76b 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -9278,6 +9278,8 @@ get_expr_indent(void)
indent = (int)eval_to_number(inde_copy);
vim_free(inde_copy);
}
+ else
+ indent = -1;
if (use_sandbox)
--sandbox;
On Thursday, April 20, 2017 at 4:13:44 PM UTC-5, John Marriott wrote:
> On 21/4/17 6:57 am, Bram Moolenaar wrote:
> > Patch 8.0.0575
> > Problem: Using freed memory when resetting 'indentexpr' while evaluating
> > it. (Dominique Pelle)
> > Solution: Make a copy of 'indentexpr'.
> > Files: src/misc1.c, src/testdir/test_options.vim
> >
> >
> I get this warning from gcc (mingw64):
> ...
> gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_GUI_W32
> -DFEAT_CLIPBOARD -pipe -march=native -Wall -O3 -fomit-frame-pointer
> -freg-struct-return -s misc1.c -o gobjnative/misc1.o
> misc1.c: In function 'get_expr_indent':
> misc1.c:9298:8: warning: 'indent' may be used uninitialized in this
> function [-Wmaybe-uninitialized]
> if (indent < 0)
> ^
> ...
>
> 'indent' probably should be initialised to something, zero perhaps?
>
> Cheers
> John
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.