r19490: better to check the return result
authorSimo Sorce <idra@samba.org>
Wed, 25 Oct 2006 01:59:07 +0000 (01:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:24:38 +0000 (14:24 -0500)
(This used to be commit abdc4edbb8f8b8234bad1be05fa92b3f3bc8876c)

source4/lib/ldb/common/ldb_msg.c

index da8ab4994fb50c9c88e2b16688979d50b658a804..9cb4cf5ed04edf6a47d6e90f248db425c6c7a9b3 100644 (file)
@@ -183,13 +183,14 @@ int ldb_msg_add_value(struct ldb_message *msg,
 {
        struct ldb_message_element *el;
        struct ldb_val *vals;
+       int ret;
 
        el = ldb_msg_find_element(msg, attr_name);
        if (!el) {
-               ldb_msg_add_empty(msg, attr_name, 0, &el);
-       }
-       if (!el) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               ret = ldb_msg_add_empty(msg, attr_name, 0, &el);
+               if (ret != LDB_SUCCESS) {
+                       return ret;
+               }
        }
 
        vals = talloc_realloc(msg, el->values, struct ldb_val, el->num_values+1);