Alexandre Julliard : server: Avoid potential NULL dereference in create_named_object().
Alexandre Julliard
julliard at winehq.org
Tue Jul 5 15:56:14 CDT 2022
Module: wine
Branch: master
Commit: 248231468d39cabcff04dd2ec57652cf3763c577
URL: https://source.winehq.org/git/wine.git/?a=commit;h=248231468d39cabcff04dd2ec57652cf3763c577
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jul 5 14:33:33 2022 +0200
server: Avoid potential NULL dereference in create_named_object().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
server/object.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/server/object.c b/server/object.c
index 907bc087444..5bb999d1fc7 100644
--- a/server/object.c
+++ b/server/object.c
@@ -331,31 +331,31 @@ void *create_named_object( struct object *parent, const struct object_ops *ops,
free_object( new_obj );
return NULL;
}
- goto done;
}
-
- if (!(obj = lookup_named_object( parent, name, attributes, &new_name ))) return NULL;
-
- if (!new_name.len)
+ else
{
- if (attributes & OBJ_OPENIF && obj->ops == ops)
- set_error( STATUS_OBJECT_NAME_EXISTS );
- else
+ if (!(obj = lookup_named_object( parent, name, attributes, &new_name ))) return NULL;
+
+ if (!new_name.len)
{
+ if (attributes & OBJ_OPENIF && obj->ops == ops)
+ {
+ set_error( STATUS_OBJECT_NAME_EXISTS );
+ return obj;
+ }
release_object( obj );
- obj = NULL;
if (attributes & OBJ_OPENIF)
set_error( STATUS_OBJECT_TYPE_MISMATCH );
else
set_error( STATUS_OBJECT_NAME_COLLISION );
+ return NULL;
}
- return obj;
- }
- new_obj = create_object( obj, ops, &new_name, attributes, sd );
- release_object( obj );
+ new_obj = create_object( obj, ops, &new_name, attributes, sd );
+ release_object( obj );
+ if (!new_obj) return NULL;
+ }
-done:
if (attributes & OBJ_PERMANENT)
{
make_object_permanent( new_obj );
More information about the wine-cvs
mailing list