src/sync_actions.c
changeset 743 e4b613ebac2f
parent 711 d88dea0f5448
child 807 a33a5f760372
     1.1 --- a/src/sync_actions.c	Tue Jun 14 10:42:07 2016 +0200
     1.2 +++ b/src/sync_actions.c	Thu Jun 16 14:20:26 2016 +0200
     1.3 @@ -32,6 +32,7 @@
     1.4      Beacon_t *msg = NULL;
     1.5      char *payload = NULL;
     1.6      message *_message = NULL;
     1.7 +    pEp_identity *me = NULL;
     1.8  
     1.9      assert(session);
    1.10      assert(!partner);
    1.11 @@ -55,7 +56,7 @@
    1.12  
    1.13      msg->state = (long) state;
    1.14  
    1.15 -    pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.16 +    me = new_identity(NULL, NULL, NULL, NULL);
    1.17      if (!me)
    1.18          goto enomem;
    1.19      status = myself(session, me);
    1.20 @@ -81,6 +82,9 @@
    1.21          goto error;
    1.22      payload = NULL;
    1.23  
    1.24 +    free_identity(me);
    1.25 +    me = NULL;
    1.26 +
    1.27      status = session->messageToSend(session->sync_obj, _message);
    1.28  
    1.29      free_message(_message);
    1.30 @@ -94,6 +98,7 @@
    1.31      ASN_STRUCT_FREE(asn_DEF_Beacon, msg);
    1.32      free(payload);
    1.33      free_message(_message);
    1.34 +    free_identity(me);
    1.35      return status;
    1.36  }
    1.37  
    1.38 @@ -118,6 +123,7 @@
    1.39      HandshakeRequest_t *msg = NULL;
    1.40      char *payload = NULL;
    1.41      message *_message = NULL;
    1.42 +    pEp_identity *me = NULL;
    1.43  
    1.44      assert(session);
    1.45      assert(partner);
    1.46 @@ -141,7 +147,7 @@
    1.47  
    1.48      msg->state = (long) state;
    1.49  
    1.50 -    pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.51 +    me = new_identity(NULL, NULL, NULL, NULL);
    1.52      if (!me)
    1.53          goto enomem;
    1.54      status = myself(session, me);
    1.55 @@ -170,6 +176,9 @@
    1.56          goto error;
    1.57      payload = NULL;
    1.58  
    1.59 +    free_identity(me);
    1.60 +    me = NULL;
    1.61 +
    1.62      status = session->messageToSend(session->sync_obj, _message);
    1.63  
    1.64      free_message(_message);
    1.65 @@ -183,6 +192,7 @@
    1.66      ASN_STRUCT_FREE(asn_DEF_HandshakeRequest, msg);
    1.67      free(payload);
    1.68      free_message(_message);
    1.69 +    free_identity(me);
    1.70      return status;
    1.71  }
    1.72  
    1.73 @@ -315,6 +325,7 @@
    1.74      GroupKeys_t *msg = NULL;
    1.75      char *payload = NULL;
    1.76      message *_message = NULL;
    1.77 +    pEp_identity *me = NULL;
    1.78  
    1.79      assert(session);
    1.80      assert(!partner);
    1.81 @@ -338,7 +349,7 @@
    1.82  
    1.83      msg->state = (long) state;
    1.84  
    1.85 -    pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.86 +    me = new_identity(NULL, NULL, NULL, NULL);
    1.87      if (!me)
    1.88          goto enomem;
    1.89      status = myself(session, me);
    1.90 @@ -364,6 +375,9 @@
    1.91          goto error;
    1.92      payload = NULL;
    1.93  
    1.94 +    free_identity(me);
    1.95 +    me = NULL;
    1.96 +
    1.97      status = session->messageToSend(session->sync_obj, _message);
    1.98  
    1.99      free_message(_message);
   1.100 @@ -377,6 +391,7 @@
   1.101      ASN_STRUCT_FREE(asn_DEF_GroupKeys, msg);
   1.102      free(payload);
   1.103      free_message(_message);
   1.104 +    free_identity(me);
   1.105      return status;
   1.106  }
   1.107