Move misplaced yajl_gen_map_close
authorAndrew Bays <andrew.bays@gmail.com>
Wed, 28 Feb 2018 19:48:23 +0000 (14:48 -0500)
committerGitHub <noreply@github.com>
Wed, 28 Feb 2018 19:48:23 +0000 (14:48 -0500)
src/sysevent.c

index 49efe75..538618c 100644 (file)
@@ -344,9 +344,6 @@ static int gen_message_payload(const char *msg, char *sev, int sev_num,
       yajl_gen_status_ok)
     goto err;
 
-  if (yajl_gen_map_close(g) != yajl_gen_status_ok)
-    goto err;
-
   // syslogMsg
   if (msg != NULL) {
     if (yajl_gen_string(g, (u_char *)SYSEVENT_SYSLOG_MSG_FIELD,
@@ -389,6 +386,9 @@ static int gen_message_payload(const char *msg, char *sev, int sev_num,
   if (yajl_gen_string(g, (u_char *)SYSEVENT_SYSLOG_TAG_VALUE,
                       strlen(SYSEVENT_SYSLOG_TAG_VALUE)) != yajl_gen_status_ok)
     goto err;
+  
+  if (yajl_gen_map_close(g) != yajl_gen_status_ok)
+    goto err;
 
   // *** END syslog fields ***