diff options
| author | Christian Hopps <chopps@labn.net> | 2023-05-19 23:12:33 -0400 | 
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2023-05-30 02:10:20 -0400 | 
| commit | 52a50ca1d799096e04a4497974a925ee71166cf9 (patch) | |
| tree | 293ea5a1c1fa57dc0a6a80491b4874e4a82bc25c /mgmtd | |
| parent | 5ba5613077c78f99ef14715bd56c796f2bfc2d95 (diff) | |
lib: mgmtd: fix memleaks
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'mgmtd')
| -rw-r--r-- | mgmtd/mgmt_txn.c | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c index 93466a2b39..ef5e7e8e32 100644 --- a/mgmtd/mgmt_txn.c +++ b/mgmtd/mgmt_txn.c @@ -1090,8 +1090,8 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req,  				&cfg_btch->data[cfg_btch->num_cfg_data]);  			cfg_btch->cfg_data[cfg_btch->num_cfg_data].data =  				&cfg_btch->data[cfg_btch->num_cfg_data]; -			cfg_btch->data[cfg_btch->num_cfg_data].xpath = xpath; -			xpath = NULL; +			cfg_btch->data[cfg_btch->num_cfg_data].xpath = +				strdup(xpath);  			mgmt_yang_data_value_init(  				&cfg_btch->value[cfg_btch->num_cfg_data]); @@ -1127,6 +1127,9 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req,  				 xpath);  			MGMTD_TXN_ERR("***** %s", err_buf);  		} + +		free(xpath); +		xpath = NULL;  	}  	cmtcfg_req->cmt_stats->last_batch_cnt = num_chgs;  | 
