Fix some json schema validation bugs
There were a couple of places where we would add null objects when
they were not allowed. Fix them.
Change-Id: I7c4c12ea1fa2913014e79603995267a9e560e288
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/ir-parse.c b/ir-parse.c
index ef588f1..e9c3966 100644
--- a/ir-parse.c
+++ b/ir-parse.c
@@ -174,17 +174,17 @@
json_object *ir = NULL;
//Find the correct section type, and parse.
- int section_converted = 0;
CPER_SECTION_DEFINITION *definition =
select_section_by_guid(&descriptor->SectionType);
- if (definition != NULL) {
+ if (definition == NULL) {
+ cper_print_log("Unknown section type guid\n");
+ } else {
ir = json_object_object_get(section, definition->ShortName);
definition->ToCPER(ir, out);
- section_converted = 1;
}
//If unknown GUID, so read as a base64 unknown section.
- if (!section_converted) {
+ if (ir == NULL) {
ir = json_object_object_get(section, "Unknown");
json_object *encoded = json_object_object_get(ir, "data");