[sr-dev] git:master:3bb1a30d: ctl: free send_buf in case of error

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 7 10:09:32 CEST 2021


Module: kamailio
Branch: master
Commit: 3bb1a30dda3b40ba2f188a4baab94ebda41f4a74
URL: https://github.com/kamailio/kamailio/commit/3bb1a30dda3b40ba2f188a4baab94ebda41f4a74

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-04-07T10:08:56+02:00

ctl: free send_buf in case of error

- disabled unused function

---

Modified: src/modules/ctl/binrpc_run.c

---

Diff:  https://github.com/kamailio/kamailio/commit/3bb1a30dda3b40ba2f188a4baab94ebda41f4a74.diff
Patch: https://github.com/kamailio/kamailio/commit/3bb1a30dda3b40ba2f188a4baab94ebda41f4a74.patch

---

diff --git a/src/modules/ctl/binrpc_run.c b/src/modules/ctl/binrpc_run.c
index 8c786a680a..5aed95c40f 100644
--- a/src/modules/ctl/binrpc_run.c
+++ b/src/modules/ctl/binrpc_run.c
@@ -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)
@@ -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,
@@ -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;
 }




More information about the sr-dev mailing list