Don't allow elements without any name
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 10 Aug 2008 09:25:53 +0000 (11:25 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 10 Aug 2008 09:25:53 +0000 (11:25 +0200)
src/element.c

index ff66bc0..5e1bea5 100644 (file)
@@ -623,8 +623,11 @@ int connman_element_register(struct connman_element *element,
 
        __connman_element_load(element);
 
-       if (element->name == NULL)
+       if (element->name == NULL) {
                element->name = g_strdup(type2string(element->type));
+               if (element->name == NULL)
+                       return -EINVAL;
+       }
 
        element->parent = parent;