Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=954415e33ed6cfa932c13e8c2460bd05e50723b5
Commit:     954415e33ed6cfa932c13e8c2460bd05e50723b5
Parent:     ed7af3b3501c8c4e3667c89c2c43347bf29ae237
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 9 23:26:53 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sat Feb 9 23:26:53 2008 -0800

    [PKT_SCHED] ematch: tcf_em_destroy robustness
    
    Make the code in tcf_em_tree_destroy more robust and cleaner:
     * Don't need to cast pointer to kfree() or avoid passing NULL.
     * After freeing the tree, clear the pointer to avoid possible problems
    from repeated free.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/sched/ematch.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index d421ec7..b29439d 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -409,14 +409,15 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct 
tcf_ematch_tree *tree)
                if (em->ops) {
                        if (em->ops->destroy)
                                em->ops->destroy(tp, em);
-                       else if (!tcf_em_is_simple(em) && em->data)
-                               kfree((void *) em->data);
+                       else if (!tcf_em_is_simple(em))
+                               kfree(em->data);
                        module_put(em->ops->owner);
                }
        }
 
        tree->hdr.nmatches = 0;
        kfree(tree->matches);
+       tree->matches = NULL;
 }
 EXPORT_SYMBOL(tcf_em_tree_destroy);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to