diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2021-09-24 01:50:07 -0700 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2021-09-24 02:09:52 -0700 |
commit | d15defeb2f3b964510e0e6013a7efef7613ad26d (patch) | |
tree | bb98ad46bea2c1337991b6614442c0aa669701c1 | |
parent | 433bda405e1fa82db23660a73f275cac5ecca95e (diff) | |
download | rneovim-d15defeb2f3b964510e0e6013a7efef7613ad26d.tar.gz rneovim-d15defeb2f3b964510e0e6013a7efef7613ad26d.tar.bz2 rneovim-d15defeb2f3b964510e0e6013a7efef7613ad26d.zip |
fix(PVS V507): false positive
https://pvs-studio.com/en/docs/warnings/v507/
"Pointer to local array 'sourcing_name_buf' is stored outside the scope
of this array. Such a pointer will become invalid."
False positive: `sourcing_name = save_sourcing_name` before returning
from this scope.
-rw-r--r-- | src/nvim/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/nvim/memory.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index d8827f0a3d..1a576bd891 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1950,7 +1950,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf), "%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name, save_sourcing_lnum); - sourcing_name = sourcing_name_buf; + sourcing_name = sourcing_name_buf; // -V507 reassigned below, before return. } sourcing_lnum = 0; diff --git a/src/nvim/memory.c b/src/nvim/memory.c index cc9c047fa0..0f5f4c1e40 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -170,6 +170,8 @@ void *xrealloc(void *ptr, size_t size) /// xmalloc() wrapper that allocates size + 1 bytes and zeroes the last byte /// +/// Commonly used to allocate strings, e.g. `char *s = xmallocz(len)`. +/// /// @see {xmalloc} /// @param size /// @return pointer to allocated space. Never NULL |