[Pkg-electronics-commits] [gnucap] 24/47: possible double free in new_subckt

felix salfelder felix-guest at moszumanska.debian.org
Mon Sep 26 10:36:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository gnucap.

commit 827fc0b2daa1c96ef23e896684a389dac63daaec
Author: Felix Salfelder <felix at salfelder.org>
Date:   Fri Sep 11 12:08:59 2015 +0200

    possible double free in new_subckt
    
    if _subckt==NULL does not hold, then ~CARD will delete _subckt a second
    time in case of an exception.
---
 lib/e_card.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/e_card.cc b/lib/e_card.cc
index ad34784..d01a5be 100644
--- a/lib/e_card.cc
+++ b/lib/e_card.cc
@@ -197,9 +197,16 @@ void CARD::new_subckt()
 }
 /*--------------------------------------------------------------------------*/
 void CARD::new_subckt(const CARD* Model, PARAM_LIST* Params)
-{
+{ itested();
   delete _subckt;
-  _subckt = new CARD_LIST(Model, this, scope(), Params);
+  try{ itested();
+    _subckt = new CARD_LIST(Model, this, scope(), Params);
+  }catch(...){ itested();
+    // BUG?
+    // new CARD_LIST must not throw if it has been successful previously.
+    assert(!_subckt);
+    throw;
+  }
 }
 /*--------------------------------------------------------------------------*/
 void CARD::renew_subckt(const CARD* Model, PARAM_LIST* Params)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git



More information about the Pkg-electronics-commits mailing list