Found a problem when using the same object in different objects
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 61
- Forks
- 35
- Avg merge
- 21m
- Merged PRs (30d)
- 2
Description
Found a problem when using the same object in different objects
fjson_object *m = fjson_object_new_object();
fjson_object *i = fjson_object_new_int(1);
fjson_object *a = fjson_object_new_object();
fjson_object_object_add(a, "i", i);
fjson_object *b = fjson_object_new_object();
fjson_object_object_add(b, "i", i);
fjson_object_object_add(m, "a", a);
fjson_object_object_add(m, "b", b);
printf("%s\n", fjson_object_to_json_string_ext(m, FJSON_TO_STRING_PLAIN));
fjson_object_put(m); // segmentation fault due to trying to delete one i in different objects
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided example, then inspect fjson_object_object_add and fjson_object_put to understand how shared objects are handled. Done means the example no longer segfaults when the same object is added to both a and b and m is released.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100