mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
				synced 2025-11-04 05:53:26 +00:00 
			
		
		
		
	osmux: Fix memleak on error code path
Change-Id: Ib84f78a53293799b925b645156513e129c32c705
This commit is contained in:
		@@ -192,6 +192,12 @@ int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn)
 | 
				
			|||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
	struct msgb *msg;
 | 
						struct msgb *msg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (conn->osmux.state != OSMUX_STATE_ENABLED) {
 | 
				
			||||||
 | 
							LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, "forwarding RTP to Osmux conn not yet enabled, dropping (cid=%d)\n",
 | 
				
			||||||
 | 
							conn->osmux.cid);
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	msg = msgb_alloc(4096, "RTP");
 | 
						msg = msgb_alloc(4096, "RTP");
 | 
				
			||||||
	if (!msg)
 | 
						if (!msg)
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
@@ -199,12 +205,6 @@ int osmux_xfrm_to_osmux(char *buf, int buf_len, struct mgcp_conn_rtp *conn)
 | 
				
			|||||||
	memcpy(msg->data, buf, buf_len);
 | 
						memcpy(msg->data, buf, buf_len);
 | 
				
			||||||
	msgb_put(msg, buf_len);
 | 
						msgb_put(msg, buf_len);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (conn->osmux.state != OSMUX_STATE_ENABLED) {
 | 
					 | 
				
			||||||
		LOGPCONN(conn->conn, DOSMUX, LOGL_INFO, "forwarding RTP to Osmux conn not yet enabled, dropping (cid=%d)\n",
 | 
					 | 
				
			||||||
		conn->osmux.cid);
 | 
					 | 
				
			||||||
		return -1;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	while ((ret = osmux_xfrm_input(conn->osmux.in, msg, conn->osmux.cid)) > 0) {
 | 
						while ((ret = osmux_xfrm_input(conn->osmux.in, msg, conn->osmux.cid)) > 0) {
 | 
				
			||||||
		/* batch full, build and deliver it */
 | 
							/* batch full, build and deliver it */
 | 
				
			||||||
		osmux_xfrm_input_deliver(conn->osmux.in);
 | 
							osmux_xfrm_input_deliver(conn->osmux.in);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user