Skip to content

Commit

Permalink
astlpc: Add mctp_astlpc_destroy()
Browse files Browse the repository at this point in the history
Provide an abstraction to cleanup memory to avoid false-positives with
leak sanitizers.

Signed-off-by: Andrew Jeffery <[email protected]>
Change-Id: Ib73506432eed108cb992cfc12b40c479b0321463
  • Loading branch information
amboar committed Mar 10, 2020
1 parent 7c73801 commit 4663f67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions astlpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@ struct mctp_binding_astlpc *mctp_astlpc_init_ops(
return astlpc;
}

void mctp_astlpc_destroy(struct mctp_binding_astlpc *astlpc)
{
if (astlpc->priv_hdr)
__mctp_free(astlpc->priv_hdr);
__mctp_free(astlpc);
}

#ifdef MCTP_HAVE_FILEIO
static int mctp_astlpc_init_fileio_lpc(struct mctp_binding_astlpc *astlpc)
{
Expand Down
1 change: 1 addition & 0 deletions libmctp-astlpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct mctp_binding_astlpc_ops {
struct mctp_binding_astlpc *mctp_astlpc_init_ops(
const struct mctp_binding_astlpc_ops *ops,
void *ops_data, void *lpc_map);
void mctp_astlpc_destroy(struct mctp_binding_astlpc *astlpc);

struct mctp_binding *mctp_binding_astlpc_core(struct mctp_binding_astlpc *b);

Expand Down

0 comments on commit 4663f67

Please sign in to comment.