BUGFIX: double free keysync
authorVolker Birk <vb@pep.foundation>
Tue, 23 Aug 2016 18:54:46 +0200
branchkeysync
changeset 10756ac3fd936e93
parent 1074 aebf26305436
child 1076 7a80153bfc5a
BUGFIX: double free
src/sync_impl.c
src/sync_send_actions.c
sync/gen_actions_skeleton.ysl2
     1.1 --- a/src/sync_impl.c	Tue Aug 23 17:35:13 2016 +0200
     1.2 +++ b/src/sync_impl.c	Tue Aug 23 18:54:46 2016 +0200
     1.3 @@ -211,7 +211,9 @@
     1.4          return status;
     1.5  
     1.6      for (identity_list *_i = own_identities; _i && _i->ident; _i = _i->next) {
     1.7 -        pEp_identity *me = _i->ident;
     1.8 +        pEp_identity *me = identity_dup(_i->ident);
     1.9 +        if (!me)
    1.10 +            goto enomem;
    1.11  
    1.12          // FIXME: no deep copy for multicast supported yet
    1.13          DeviceGroup_Protocol_t *_msg = malloc(sizeof(DeviceGroup_Protocol_t));
     2.1 --- a/src/sync_send_actions.c	Tue Aug 23 17:35:13 2016 +0200
     2.2 +++ b/src/sync_send_actions.c	Tue Aug 23 18:54:46 2016 +0200
     2.3 @@ -51,6 +51,7 @@
     2.4  enomem:
     2.5      status = PEP_OUT_OF_MEMORY;
     2.6  error:
     2.7 +    free(partner);
     2.8      free_DeviceGroup_Protocol_msg(msg);
     2.9      return status;
    2.10  }
    2.11 @@ -93,6 +94,7 @@
    2.12  enomem:
    2.13      status = PEP_OUT_OF_MEMORY;
    2.14  error:
    2.15 +    free(partner);
    2.16      free_DeviceGroup_Protocol_msg(msg);
    2.17      return status;
    2.18  }
    2.19 @@ -143,6 +145,7 @@
    2.20  enomem:
    2.21      status = PEP_OUT_OF_MEMORY;
    2.22  error:
    2.23 +    free(partner);
    2.24      free_DeviceGroup_Protocol_msg(msg);
    2.25      free_identity_list(kl);
    2.26      return status;
     3.1 --- a/sync/gen_actions_skeleton.ysl2	Tue Aug 23 17:35:13 2016 +0200
     3.2 +++ b/sync/gen_actions_skeleton.ysl2	Tue Aug 23 18:54:46 2016 +0200
     3.3 @@ -198,6 +198,7 @@
     3.4          enomem:
     3.5              status = PEP_OUT_OF_MEMORY;
     3.6          error:
     3.7 +            free(partner);
     3.8              free_DeviceGroup_Protocol_msg(msg);
     3.9              `` if "$name='GroupKeys'" |> free_identity_list(kl);
    3.10              return status;