ENGINE-362: possible fix for empty opt_fields which may be causing the problem
authorKrista Bennett <krista@pep-project.org>
Wed, 21 Feb 2018 15:47:21 +0100
changeset 2529d40fa7b81cc6
parent 2528 d4dc200db65e
child 2530 f460c1c5f1cb
ENGINE-362: possible fix for empty opt_fields which may be causing the problem
src/message_api.c
     1.1 --- a/src/message_api.c	Wed Feb 21 09:57:53 2018 +0100
     1.2 +++ b/src/message_api.c	Wed Feb 21 15:47:21 2018 +0100
     1.3 @@ -175,6 +175,12 @@
     1.4      if (msg && name && value) {
     1.5          stringpair_list_t* opt_fields = msg->opt_fields;
     1.6          stringpair_t* pair = NULL;
     1.7 +        
     1.8 +        if (!opt_fields) {
     1.9 +            msg->opt_fields = new_stringpair_list(NULL);
    1.10 +            opt_fields = msg->opt_fields;
    1.11 +        }
    1.12 +        
    1.13          if (opt_fields) {
    1.14              while (opt_fields) {
    1.15                  pair = opt_fields->value;
    1.16 @@ -185,6 +191,9 @@
    1.17                  opt_fields = opt_fields->next;
    1.18              }
    1.19          }
    1.20 +        else
    1.21 +            return;
    1.22 +
    1.23          
    1.24          if (pair) {
    1.25              free(pair->value);