Projects
Factory:RISC-V:Base
json-c
_service:tar_scm:backport-Add-test-to-check-for...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-Add-test-to-check-for-the-memory-leak-mentioned-in-issue-781.patch of Package json-c
From 16208fc01afcd742fd5e6736f52849ad2ec03e8f Mon Sep 17 00:00:00 2001 From: Eric Haszlakiewicz <erh+git@nimenees.com> Date: Sun, 24 Jul 2022 18:59:26 +0000 Subject: [PATCH] Add test to check for the memory leak mentioned in issue #781 Conflict:NA Reference:https://github.com/json-c/json-c/commit/16208fc01afcd742fd5e6736f52849ad2ec03e8f --- tests/test_set_value.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_set_value.c b/tests/test_set_value.c index f51a2a5b67..a8ebbfec79 100644 --- a/tests/test_set_value.c +++ b/tests/test_set_value.c @@ -71,6 +71,14 @@ int main(int argc, char **argv) json_object_set_string(tmp, SHORT); assert(strcmp(json_object_get_string(tmp), SHORT) == 0); assert(strcmp(json_object_to_json_string(tmp), "\"" SHORT "\"") == 0); + + // Set an empty string a couple times to try to trigger + // a case that used to leak memory. + json_object_set_string(tmp, ""); + json_object_set_string(tmp, HUGE); + json_object_set_string(tmp, ""); + json_object_set_string(tmp, HUGE); + json_object_put(tmp); printf("STRING PASSED\n");
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2