Hi

Attached patch cleans up a few warnings reported by cppcheck:

[vim/src/channel.c:2574]: (error) Common realloc mistake: 'buf' nulled
but not freed upon failure

[vim/src/edit.c:9527]: (warning) Char literal compared with pointer
'end'. Did you intend to dereference it?

[vim/src/farsi.c:1698]: (style) Array index 'i' is used before limits check.


Dominique

-- 
-- 
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.
diff --git a/src/channel.c b/src/channel.c
index 410f928..106b711 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2571,9 +2571,12 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
 	    if (nl == NULL)
 	    {
 		/* Flush remaining message that is missing a NL. */
-		buf = vim_realloc(buf, node->rq_buflen + 1);
-		if (buf == NULL)
+		char_u	*new_buf;
+
+		new_buf = vim_realloc(buf, node->rq_buflen + 1);
+		if (new_buf == NULL)
 		    return FALSE;
+		buf = new_buf;
 		node->rq_buffer = buf;
 		nl = buf + node->rq_buflen++;
 		*nl = NUL;
diff --git a/src/edit.c b/src/edit.c
index ad8b89a..0153f3b 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -9524,7 +9524,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
 #endif
 	    buf[idx++] = c;
 	buf[idx] = NUL;
-	if (end != NUL && STRNCMP(buf, end, idx) == 0)
+	if (end != NULL && STRNCMP(buf, end, idx) == 0)
 	{
 	    if (end[idx] == NUL)
 		break; /* Found the end of paste code. */
diff --git a/src/farsi.c b/src/farsi.c
index bac1510..ebed47e 100644
--- a/src/farsi.c
+++ b/src/farsi.c
@@ -1695,7 +1695,7 @@ conv_to_pvim(void)
 		ptr[i] = toF_leading(ptr[i]);
 		++i;
 
-		while (canF_Rjoin(ptr[i]) && i < llen)
+		while (i < llen && canF_Rjoin(ptr[i]))
 		{
 		    ptr[i] = toF_Rjoin(ptr[i]);
 		    if (F_isterm(ptr[i]) || !F_isalpha(ptr[i]))

Raspunde prin e-mail lui