From a39e781f2dcd56e155b0612cb1e045bb485c5c23 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 20 Mar 2007 20:19:29 +0000 Subject: 2007-03-20 Martin Hunt * symbols.c (_stp_alloc_module): Fix up error cleanup when malloc fails. --- runtime/transport/ChangeLog | 5 +++++ runtime/transport/symbols.c | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index f9dca7f2..dcee1d79 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,3 +1,8 @@ +2007-03-20 Martin Hunt + + * symbols.c (_stp_alloc_module): Fix up error + cleanup when malloc fails. + 2007-03-14 Martin Hunt * transport_msgs.h: ifdef old messages as such. diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index 72070c7d..9d5163d0 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -86,12 +86,13 @@ static struct _stp_module * _stp_alloc_module(unsigned num, unsigned datasize) return mod; bad: - if (mod) - kfree(mod); - if (mod->allocated && mod->symbols) - vfree(mod->symbols); - else - kfree(mod->symbols); + if (mod) { + if (mod->allocated && mod->symbols) + vfree(mod->symbols); + else + kfree(mod->symbols); + kfree(mod); + } return NULL; } -- cgit