Fix reference counting on true, false and null
[jansson.git] / src / value.c
index 345ff8e..3fa7ee3 100644 (file)
@@ -784,7 +784,7 @@ json_t *json_true(void)
 {
     static json_t the_true = {
         .type = JSON_TRUE,
-        .refcount = (unsigned int)1
+        .refcount = (unsigned int)-1
     };
     return &the_true;
 }
@@ -794,7 +794,7 @@ json_t *json_false(void)
 {
     static json_t the_false = {
         .type = JSON_FALSE,
-        .refcount = (unsigned int)1
+        .refcount = (unsigned int)-1
     };
     return &the_false;
 }
@@ -804,7 +804,7 @@ json_t *json_null(void)
 {
     static json_t the_null = {
         .type = JSON_NULL,
-        .refcount = (unsigned int)1
+        .refcount = (unsigned int)-1
     };
     return &the_null;
 }