yjson: debug error format object, add check NULL before free

This commit is contained in:
2025-10-18 00:30:56 +02:00
parent c0e610641f
commit fe3a0cf11e
2 changed files with 38 additions and 3 deletions
+12
View File
@@ -500,6 +500,18 @@ printf("\n##############################################\n");
}
TEST(errorFormat){
char *val1="{ \"hey\" }";
struct js_value *js = create_js_value(val1, NULL);
EXPECT_EQ(js==NULL,1);
char *val2="{ \"hey }";
js = create_js_value(val2, NULL);
EXPECT_EQ(js==NULL,1);
char *val3="{ 123 }";
js = create_js_value(val3, NULL);
EXPECT_EQ(js==NULL,1);
}
int main(int argc, char **argv){