copying keysync
authorVolker Birk <vb@pep.foundation>
Tue, 23 Aug 2016 14:58:47 +0200
branchkeysync
changeset 1065090aa9b11a99
parent 1064 8a6ce228b20c
child 1066 e6db6bb9d542
copying
src/sync_impl.c
     1.1 --- a/src/sync_impl.c	Tue Aug 23 13:59:36 2016 +0200
     1.2 +++ b/src/sync_impl.c	Tue Aug 23 14:58:47 2016 +0200
     1.3 @@ -220,16 +220,26 @@
     1.4  
     1.5          status = myself(session, me);
     1.6          if (status == PEP_OUT_OF_MEMORY)
     1.7 -            goto the_end;
     1.8 +            goto enomem;
     1.9          if (status != PEP_STATUS_OK)
    1.10              continue;
    1.11       
    1.12 -        status = unicast_msg(session, me, state, msg);
    1.13 +        // FIXME: no deep copy for multicast supported yet
    1.14 +        DeviceGroup_Protocol_t *_msg = malloc(sizeof(DeviceGroup_Protocol_t));
    1.15 +        assert(_msg);
    1.16 +        if (_msg == NULL)
    1.17 +            goto enomem;
    1.18 +        memcpy(_msg, msg, sizeof(DeviceGroup_Protocol_t));
    1.19 +        status = unicast_msg(session, me, state, _msg);
    1.20      }
    1.21  
    1.22 -the_end:
    1.23      free_identity_list(own_identities);
    1.24      free_DeviceGroup_Protocol_msg(msg);
    1.25      return PEP_STATUS_OK;
    1.26 +
    1.27 +enomem:
    1.28 +    free_identity_list(own_identities);
    1.29 +    free_DeviceGroup_Protocol_msg(msg);
    1.30 +    return PEP_OUT_OF_MEMORY;
    1.31  }
    1.32