Code

store: Support NULL attribute values.
authorSebastian Harl <sh@tokkee.org>
Sat, 17 Aug 2013 20:09:10 +0000 (22:09 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 17 Aug 2013 20:09:10 +0000 (22:09 +0200)
src/core/store.c

index dba88cd2a03a70e126bf0b409e9d68b6b85e6b25..eebe24b0ed48b7db014bc64dca3dd4c42fce1620 100644 (file)
@@ -219,9 +219,11 @@ sdb_attr_init(sdb_object_t *obj, va_list ap)
                return ret;
        value = va_arg(ap, const char *);
 
-       SDB_ATTR(obj)->value = strdup(value);
-       if (! SDB_ATTR(obj)->value)
-               return -1;
+       if (value) {
+               SDB_ATTR(obj)->value = strdup(value);
+               if (! SDB_ATTR(obj)->value)
+                       return -1;
+       }
        return 0;
 } /* sdb_attr_init */