PERFORCE change 19580 for review

Robert Watson rwatson at freebsd.org
Fri Oct 18 21:01:21 GMT 2002


http://perforce.freebsd.org/chv.cgi?CH=19580

Change 19580 by rwatson at rwatson_tislabs on 2002/10/18 14:00:20

	Merge two semantically similar but syntactically different
	ACL memory leak fixes.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/ufs/ufs/ufs_vnops.c#54 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/ufs/ufs/ufs_vnops.c#54 (text+ko) ====

@@ -1356,7 +1356,7 @@
 	struct dirtemplate dirtemplate, *dtp;
 	struct direct newdir;
 #ifdef UFS_ACL
-	struct acl *acl = NULL, *dacl = NULL;
+	struct acl *acl, *dacl;
 #endif
 	int error, dmode;
 	long blkoff;
@@ -1559,11 +1559,12 @@
 			break;
 
 		default:
+			FREE(acl, M_ACL);
+			FREE(dacl, M_ACL);
 			goto bad;
 		}
 		FREE(acl, M_ACL);
 		FREE(dacl, M_ACL);
-		acl = dacl = NULL;
 	}
 #endif /* !UFS_ACL */
 
@@ -1647,12 +1648,6 @@
 		vput(tvp);
 	}
 out:
-#ifdef UFS_ACL
-	if (acl != NULL)
-		FREE(acl, M_ACL);
-	if (dacl != NULL)
-		FREE(dacl, M_ACL);
-#endif /* UFS_ACL */
 	return (error);
 }
 
@@ -2289,7 +2284,7 @@
 	struct direct newdir;
 	struct vnode *tvp;
 #ifdef UFS_ACL
-	struct acl *acl = NULL;
+	struct acl *acl;
 #endif
 	int error;
 
@@ -2475,10 +2470,10 @@
 			break;
 
 		default:
+			FREE(acl, M_ACL);
 			goto bad;
 		}
 		FREE(acl, M_ACL);
-		acl = NULL;
 	}
 #endif /* !UFS_ACL */
 	ufs_makedirentry(ip, cnp, &newdir);
@@ -2500,10 +2495,6 @@
 	if (DOINGSOFTDEP(tvp))
 		softdep_change_linkcnt(ip);
 	vput(tvp);
-#ifdef UFS_ACL
-	if (acl != NULL)
-		FREE(acl, M_ACL);
-#endif /* UFS_ACL */
 	return (error);
 }
 
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list