lkml.org 
[lkml]   [2003]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: seq_file API strangeness
Hi Al,

On the same subject, but a different issue:

In the ->open() method I allocate a seq->private like this:

err = seq_open(file, sop);
if (!err) {
struct seq_file *m = file->private_data;

m->private = kmalloc(sizeof(struct ctask), GFP_KERNEL);
if (!m->private) {
kfree(file->private_data);
return -ENOMEM;
}
}

Now, freeing the structure that I did not allocate (file->private_data
allocated in seq_open()) is not nice. But calling seq_release() from
->open() method is not nice either (different arguments, namely 'inode'
and also m->buf is NULL at that point, although I believe kfree(NULL) is
not illegal).

What do you think?

Kind regards
Tigran

-
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 13:58    [W:0.028 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site