Skip to content

Commit

Permalink
ctl: free send_buf in case of error
Browse files Browse the repository at this point in the history
- disabled unused function

(cherry picked from commit 3bb1a30)
  • Loading branch information
miconda committed Apr 13, 2021
1 parent 9d8b937 commit bb1102a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/ctl/binrpc_run.c
Expand Up @@ -223,7 +223,7 @@ static struct rpc_struct_l* grow_rpc_struct(struct rpc_struct_l *rs)
#endif



#if 0
/* appends buf to an already init. binrpc_pkt */
inline static int append_pkt_body(struct binrpc_pkt* p, unsigned char* buf,
int len)
Expand All @@ -247,7 +247,7 @@ inline static int append_pkt_body(struct binrpc_pkt* p, unsigned char* buf,
error:
return -1; /* buff. overflow */
}

#endif


inline static int append_iovec(struct iovec_array* a, unsigned char* buf,
Expand Down Expand Up @@ -379,6 +379,9 @@ inline static int init_binrpc_ctx( struct binrpc_ctx* ctx,
}
/* we'll keep only the body */
err=binrpc_init_pkt(&ctx->out.pkt, send_buf, send_buf_len);
if(err!=0) {
ctl_free(send_buf);
}
end:
return err;
}
Expand Down

0 comments on commit bb1102a

Please sign in to comment.