From 1a2ac459a9188b2f7404f4d7cf7af78cda3522b9 Mon Sep 17 00:00:00 2001 From: Christian Brueffer Date: Fri, 2 May 2014 20:41:09 +0000 Subject: [PATCH] Properly free resources in case of error. CID: 1007032 Found with: Coverity Prevent(tm) MFC after: 2 weeks --- lib/libc/rpc/clnt_vc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c index 7cd93b37e9de..117cfba65486 100644 --- a/lib/libc/rpc/clnt_vc.c +++ b/lib/libc/rpc/clnt_vc.c @@ -301,15 +301,13 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz) return (cl); err: - if (cl) { - if (ct) { - if (ct->ct_addr.len) - mem_free(ct->ct_addr.buf, ct->ct_addr.len); - mem_free(ct, sizeof (struct ct_data)); - } - if (cl) - mem_free(cl, sizeof (CLIENT)); + if (ct) { + if (ct->ct_addr.len) + mem_free(ct->ct_addr.buf, ct->ct_addr.len); + mem_free(ct, sizeof (struct ct_data)); } + if (cl) + mem_free(cl, sizeof (CLIENT)); return ((CLIENT *)NULL); }