From 9a7b41ad53e3682e06cb06d601cdce475dd5bd00 Mon Sep 17 00:00:00 2001 From: Vitaliy Margolen Date: Wed, 28 Sep 2005 12:04:51 +0000 Subject: [PATCH] Fix refcount leak and return correct error in create_named_object. --- server/object.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/object.c b/server/object.c index 1a629ece722..a66875a2362 100644 --- a/server/object.c +++ b/server/object.c @@ -166,13 +166,13 @@ void *create_named_object( struct namespace *namespace, const struct object_ops if ((obj = find_object( namespace, name, len ))) { - if (obj->ops == ops) + if (obj->ops != ops) { - set_error( STATUS_OBJECT_NAME_COLLISION ); - return obj; + release_object( obj ); + obj = NULL; } - set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return NULL; + set_error( STATUS_OBJECT_NAME_COLLISION ); + return obj; } if (!(name_ptr = alloc_name( name, len ))) return NULL; if ((obj = alloc_object( ops )))