From 813462bebae17e1f77c6fd9ee9b42da54ed53b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Tue, 2 Apr 2024 07:55:01 +0100 Subject: [PATCH] Fix memory leaks in dev_c7200_pa_bri_init. Fixes #109 --- common/dev_c7200_bri.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/dev_c7200_bri.c b/common/dev_c7200_bri.c index 4c5bf7b8a..66f5e1bbe 100644 --- a/common/dev_c7200_bri.c +++ b/common/dev_c7200_bri.c @@ -816,6 +816,7 @@ int dev_c7200_pa_bri_init(vm_instance_t *vm,struct cisco_card *card) if (!pci_dev) { vm_error(vm,"%s: unable to create PCI device.\n",card->dev_name); + free(d); return(-1); } @@ -827,6 +828,8 @@ int dev_c7200_pa_bri_init(vm_instance_t *vm,struct cisco_card *card) /* Create the device itself */ if (!(dev = dev_create(card->dev_name))) { vm_error(vm,"%s: unable to create device.\n",card->dev_name); + pci_dev_remove(d->pci_dev); + free(d); return(-1); }