x86: fix seq_file iteration for pat/memtype.c
[linux-2.6-microblaze.git] / arch / x86 / mm / pat / memtype.c
index 8f665c3..ca311aa 100644 (file)
@@ -1164,12 +1164,14 @@ static void *memtype_seq_start(struct seq_file *seq, loff_t *pos)
 
 static void *memtype_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
+       kfree(v);
        ++*pos;
        return memtype_get_idx(*pos);
 }
 
 static void memtype_seq_stop(struct seq_file *seq, void *v)
 {
+       kfree(v);
 }
 
 static int memtype_seq_show(struct seq_file *seq, void *v)
@@ -1181,8 +1183,6 @@ static int memtype_seq_show(struct seq_file *seq, void *v)
                        entry_print->end,
                        cattr_name(entry_print->type));
 
-       kfree(entry_print);
-
        return 0;
 }