From: Nickolai Zeldovich Date: Thu, 14 Aug 2003 04:55:55 +0000 (+0000) Subject: memory-allocation-fixes-20030813 X-Git-Tag: openafs-devel-1_3_50~87 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=d2c30d069bb9ea803b347d9482ef788f59da3566;p=packages%2Fo%2Fopenafs.git memory-allocation-fixes-20030813 Properly free allocated memory from osi_AllocLargeSpace and check the amount of memory requested from osi_AllocSmallSpace to avoid a possible panic. --- diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 5fff99e53..b794f9de8 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -148,8 +148,8 @@ EvalMountPoint(register struct vcache *avc, struct vcache *advc, * doesn't exist? Try adding ".readonly" to volname and look for that. * Don't know why we do this. Would have still found it in above call - jpm. */ - if (!tvp && (prefetch == 2)) { - buf = (char *)osi_AllocSmallSpace(strlen(volnamep) + 10); + if (!tvp && (prefetch == 2) && len < AFS_SMALLOCSIZ - 10) { + buf = (char *)osi_AllocSmallSpace(len + 10); strcpy(buf, volnamep); afs_strcat(buf, ".readonly"); @@ -1291,6 +1291,8 @@ OSI_VC_DECL(adp); ReleaseReadLock(&tdc->lock); ReleaseReadLock(&adp->lock); afs_PutDCache(tdc); + if (tname && tname != aname) + osi_FreeLargeSpace(tname); goto redo; }