[patch: libc/rpc/svc_vc.c] clang analyser: Branch condition evaluates to a garbage value
Boris Samorodov
bsam at passap.ru
Sat Feb 1 19:11:33 UTC 2014
Hi All,
While using clang static analyzer at CURRENT (r261322) I got:
http://gw.wart.ru/2014-02-01-200848-39517-1/report-01bc48.html
There is no need at line 143 to "goto cleanup_svc_vc_create" (neither
xprt nor r are allocated so far). Just "return NULL" should be fine.
BTW, NetBSD do the latter as well.
So I propose a tiny patch (attached).
--
WBR, Boris Samorodov (bsam)
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
-------------- next part --------------
Index: /usr/src/lib/libc/rpc/svc_vc.c
===================================================================
--- /usr/src/lib/libc/rpc/svc_vc.c (revision 260036)
+++ /usr/src/lib/libc/rpc/svc_vc.c (working copy)
@@ -141,7 +141,7 @@
r = mem_alloc(sizeof(*r));
if (r == NULL) {
warnx("svc_vc_create: out of memory");
- goto cleanup_svc_vc_create;
+ return NULL;
}
r->sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize);
r->recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
More information about the freebsd-current
mailing list