From: Marcio Barbosa Date: Thu, 3 Mar 2016 21:23:28 +0000 (-0300) Subject: afs: fix memory leak X-Git-Tag: upstream/1.6.20^2~25 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=8b1aa797a2833ed6db2c67e080b4d7f93a9a8d22;p=packages%2Fo%2Fopenafs.git afs: fix memory leak An error code is returned by afs_ProcessOpCreate if this function can not allocate memory for ttargetName. This function should release the memory previously allocated for tname and decrement the reference count of tdp as well. Reviewed-on: https://gerrit.openafs.org/12208 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit bc123573539084ffc5a16ef1efaaaced5b2be202) Change-Id: Ia5a09fe860b7a110ad55c111551702e20367ba1b Reviewed-on: https://gerrit.openafs.org/12309 Tested-by: BuildBot Reviewed-by: Marcio Brito Barbosa Reviewed-by: Mark Vitale Reviewed-by: Michael Meffie Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index cfd5d632c..9198ed4d5 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -702,7 +702,8 @@ afs_ProcessOpCreate(struct vcache *avc, struct vrequest *areq, ttargetName = afs_osi_Alloc(tlen); if (!ttargetName) { afs_PutDCache(tdc); - return ENOMEM; + code = ENOMEM; + goto end; } ObtainReadLock(&tdc->lock); tfile = afs_CFileOpen(&tdc->f.inode);