Pulled declaractions of own_id to top level; fixed mem leak
authorKrista Bennett <krista@pep-project.org>
Thu, 18 Jan 2018 08:11:23 +0100
changeset 2411406244dbf80c
parent 2410 721952accdee
child 2412 d44dce6de6dc
Pulled declaractions of own_id to top level; fixed mem leak
src/sync_impl.c
     1.1 --- a/src/sync_impl.c	Thu Jan 18 00:46:19 2018 +0100
     1.2 +++ b/src/sync_impl.c	Thu Jan 18 08:11:23 2018 +0100
     1.3 @@ -71,6 +71,7 @@
     1.4      assert(session && sync_msg);
     1.5      if (!(session && sync_msg))
     1.6          return PEP_ILLEGAL_VALUE;
     1.7 +    char* own_id = NULL;
     1.8  
     1.9      bool msgIsFromGroup = false;
    1.10      if(sync_msg->is_a_message){
    1.11 @@ -276,7 +277,6 @@
    1.12      // be able to communicate securely with it.
    1.13      if(partner){
    1.14          
    1.15 -        char* own_id = NULL;
    1.16          status = get_default_own_userid(session, &own_id);
    1.17          
    1.18          if (!own_id)
    1.19 @@ -358,7 +358,8 @@
    1.20      }
    1.21  
    1.22      free(sync_msg);
    1.23 -
    1.24 +    free(own_id);
    1.25 +    
    1.26      return status;
    1.27  }
    1.28  
    1.29 @@ -786,6 +787,7 @@
    1.30      message *_message = NULL;
    1.31      pEp_identity *me = NULL;
    1.32      pEp_identity *_me = NULL;
    1.33 +    char* own_id = NULL;
    1.34  
    1.35      assert(session && partner && state && msg);
    1.36      if (!(session && partner && state && msg))
    1.37 @@ -797,7 +799,6 @@
    1.38          goto error;
    1.39      }
    1.40  
    1.41 -    char* own_id = NULL;
    1.42      status = get_default_own_userid(session, &own_id);
    1.43      if (status != PEP_STATUS_OK)
    1.44          goto error;