mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] don't check for NULL before calling kfree() in fs/ntfs/
@ 2005-03-25 22:25 Jesper Juhl
  2005-04-04 14:11 ` Anton Altaparmakov
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2005-03-25 22:25 UTC (permalink / raw)
  To: Anton Altaparmakov; +Cc: linux-ntfs-dev, linux-kernel

(please keep me on CC)


There's no need to check a pointer for NULL before calling kfree() on it - 
kfree() handles NULL pointers just fine on its own.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

--- linux-2.6.12-rc1-mm3-orig/fs/ntfs/dir.c	2005-03-25 15:28:59.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/ntfs/dir.c	2005-03-25 22:51:46.000000000 +0100
@@ -183,8 +183,7 @@ found_it:
 				name->len = 0;
 				*res = name;
 			} else {
-				if (name)
-					kfree(name);
+				kfree(name);
 				*res = NULL;
 			}
 			mref = le64_to_cpu(ie->data.dir.indexed_file);
@@ -444,8 +443,7 @@ found_it2:
 				name->len = 0;
 				*res = name;
 			} else {
-				if (name)
-					kfree(name);
+				kfree(name);
 				*res = NULL;
 			}
 			mref = le64_to_cpu(ie->data.dir.indexed_file);
@@ -1462,10 +1460,8 @@ err_out:
 		unlock_page(ia_page);
 		ntfs_unmap_page(ia_page);
 	}
-	if (ir)
-		kfree(ir);
-	if (name)
-		kfree(name);
+	kfree(ir);
+	kfree(name);
 	if (ctx)
 		ntfs_attr_put_search_ctx(ctx);
 	if (m)
--- linux-2.6.12-rc1-mm3-orig/fs/ntfs/namei.c	2005-03-25 15:28:59.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/ntfs/namei.c	2005-03-25 22:52:36.000000000 +0100
@@ -153,8 +153,7 @@ static struct dentry *ntfs_lookup(struct
 			ntfs_error(vol->sb, "ntfs_iget(0x%lx) failed with "
 					"error code %li.", dent_ino,
 					PTR_ERR(dent_inode));
-		if (name)
-			kfree(name);
+		kfree(name);
 		/* Return the error code. */
 		return (struct dentry *)dent_inode;
 	}
--- linux-2.6.12-rc1-mm3-orig/fs/ntfs/super.c	2005-03-25 15:28:59.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/ntfs/super.c	2005-03-25 22:52:49.000000000 +0100
@@ -1193,8 +1193,7 @@ static BOOL load_and_init_quota(ntfs_vol
 		return FALSE;
 	}
 	/* We do not care for the type of match that was found. */
-	if (name)
-		kfree(name);
+	kfree(name);
 	/* Get the inode. */
 	tmp_ino = ntfs_iget(vol->sb, MREF(mref));
 	if (IS_ERR(tmp_ino) || is_bad_inode(tmp_ino)) {



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-04 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-25 22:25 [PATCH] don't check for NULL before calling kfree() in fs/ntfs/ Jesper Juhl
2005-04-04 14:11 ` Anton Altaparmakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®