r7780: fixed a bug in talloc_find_parent_byname()
authorAndrew Tridgell <tridge@samba.org>
Mon, 20 Jun 2005 05:21:11 +0000 (05:21 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:18:35 +0000 (13:18 -0500)
source/lib/talloc/talloc.c

index c6f748ea3b4d6cf8acc0ad5e85c48cd9334a0a58..9dd7ef36c71092d6832739db082e6be37506782c 100644 (file)
@@ -1127,7 +1127,7 @@ void *talloc_find_parent_byname(const void *context, const char *name)
        while (tc->parent && (!tc->name || strcmp(tc->name, name))) {
                tc = tc->parent;
        }
-       if (tc == NULL) {
+       if (tc == NULL || tc->name == NULL || strcmp(tc->name, name)) {
                return NULL;
        }
        return (void *)(tc+1);