From 45edfaa5dbdebb38d0eddd6d30e9d323e697b655 Mon Sep 17 00:00:00 2001 From: Durga Prasada Rao BATHINA Date: Wed, 24 Aug 2011 19:17:21 +0530 Subject: CAIF : coverity issues free phy_driver memory and initialize linkid to 0. ST-Ericsson ID: 358047 ST-Ericsson Linux next: NA ST-Ericsson FOSS-OUT ID: NA Change-Id: Icb295648b23bd836b9f5a40a0b605e4792a8511d Signed-off-by: Durga Prasada Rao BATHINA Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/31751 Reviewed-by: Bibek BASU Tested-by: Bibek BASU --- include/net/caif/cfserl.h | 1 + net/caif/cfcnfg.c | 2 ++ net/caif/cfserl.c | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h index b8374321b36..8ac284c5de2 100644 --- a/include/net/caif/cfserl.h +++ b/include/net/caif/cfserl.h @@ -9,4 +9,5 @@ #include struct cflayer *cfserl_create(int type, int instance, bool use_stx); +void cfserl_destroy(struct cflayer *layer); #endif /* CFSERL_H_ */ diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 52fe33bee02..7debfd4a031 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c @@ -521,6 +521,8 @@ got_phyid: frml = cffrml_create(phyid, fcs); if (!frml) { + if (phy_driver) + cfserl_destroy(phy_driver); pr_warn("Out of memory\n"); kfree(phyinfo); goto out; diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c index 2715c84cfa8..403d57ad305 100644 --- a/net/caif/cfserl.c +++ b/net/caif/cfserl.c @@ -190,3 +190,9 @@ static void cfserl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, { layr->up->ctrlcmd(layr->up, ctrl, phyid); } + +void cfserl_destroy(struct cflayer *layer) +{ + struct cfserl *cfserl = container_obj(layer); + kfree(cfserl); +} -- cgit v1.2.3