lkml.org 
[lkml]   [2004]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [CHECKER] Memory Leak on commonly executed path in jfs_link (JFS 2.4, kernel 2.4.19)
From
Date
On Fri, 2004-04-30 at 17:31, Junfeng Yang wrote:
> get_UCSname is a memory allocation function. Should call
> free_UCSname(&dname) to free the allocated memory

I'm embarrassed to see how long this one has gone undetected. Here's a
patch. I'll send these to Marcelo and Linus after more complete
testing.

===== fs/jfs/namei.c 1.22 vs edited =====
--- 1.22/fs/jfs/namei.c Wed Mar 24 14:55:56 2004
+++ edited/fs/jfs/namei.c Tue May 4 12:54:00 2004
@@ -784,14 +784,14 @@
goto out;

if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE)))
- goto out;
+ goto free_dname;

/*
* create entry for new link in parent directory
*/
ino = ip->i_ino;
if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack)))
- goto out;
+ goto free_dname;

/* update object inode */
ip->i_nlink++; /* for new link */
@@ -803,6 +803,9 @@
iplist[0] = ip;
iplist[1] = dir;
rc = txCommit(tid, 2, &iplist[0], 0);
+
+ free_dname:
+ free_UCSname(&dname);

out:
txEnd(tid);
--
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.402 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site