Skip to content

Commit

Permalink
HBSD MFC: kgssapi: Don't leak memory in error cases
Browse files Browse the repository at this point in the history
Reported by:	Coverity
CIDs:		1007046, 1007047, 1007048
Sponsored by:	EMC / Isilon Storage Division

(cherry picked from commit 933a29e)
Signed-off-by: Oliver Pinter <[email protected]>
  • Loading branch information
cemeyer authored and opntr committed Apr 26, 2016
1 parent a9b0932 commit 4b82916
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sys/kgssapi/gssd_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ xdr_gss_OID(XDR *xdrs, gss_OID *oidp)
} else {
oid = mem_alloc(sizeof(gss_OID_desc));
memset(oid, 0, sizeof(*oid));
if (!xdr_gss_OID_desc(xdrs, oid))
if (!xdr_gss_OID_desc(xdrs, oid)) {
mem_free(oid, sizeof(gss_OID_desc));
return (FALSE);
}
*oidp = oid;
}
break;
Expand Down Expand Up @@ -164,8 +166,10 @@ xdr_gss_OID_set(XDR *xdrs, gss_OID_set *setp)
} else {
set = mem_alloc(sizeof(gss_OID_set_desc));
memset(set, 0, sizeof(*set));
if (!xdr_gss_OID_set_desc(xdrs, set))
if (!xdr_gss_OID_set_desc(xdrs, set)) {
mem_free(set, sizeof(gss_OID_set_desc));
return (FALSE);
}
*setp = set;
}
break;
Expand Down Expand Up @@ -224,8 +228,10 @@ xdr_gss_channel_bindings_t(XDR *xdrs, gss_channel_bindings_t *chp)
|| !xdr_gss_buffer_desc(xdrs,
&ch->acceptor_address)
|| !xdr_gss_buffer_desc(xdrs,
&ch->application_data))
&ch->application_data)) {
mem_free(ch, sizeof(*ch));
return (FALSE);
}
*chp = ch;
}
break;
Expand Down

0 comments on commit 4b82916

Please sign in to comment.