From bc123573539084ffc5a16ef1efaaaced5b2be202 Mon Sep 17 00:00:00 2001 From: Marcio Barbosa Date: Thu, 3 Mar 2016 18:23:28 -0300 Subject: [PATCH] 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. Change-Id: Ic771b1d57080df6ee562a7327762030afdd5b08c Reviewed-on: https://gerrit.openafs.org/12208 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/afs_disconnected.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index a83d076de1..692dcbcd33 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);