src/map_asn1.c
changeset 654 0aa96447e38f
parent 648 1f83d8ad4f55
child 667 a3615d44326a
     1.1 --- a/src/map_asn1.c	Wed May 18 12:22:02 2016 +0200
     1.2 +++ b/src/map_asn1.c	Wed May 18 12:54:22 2016 +0200
     1.3 @@ -1,13 +1,14 @@
     1.4  #include "pEp_internal.h"
     1.5  #include "map_asn1.h"
     1.6  
     1.7 -Identity_t *Identity_from_Struct(const pEp_identity *ident)
     1.8 +Identity_t *Identity_from_Struct(const pEp_identity *ident, Identity_t *result)
     1.9  {
    1.10      assert(ident);
    1.11      if (!ident)
    1.12          return NULL;
    1.13  
    1.14 -    Identity_t *result = (Identity_t *) calloc(1, sizeof(Identity_t));
    1.15 +    if (!result)
    1.16 +        result = (Identity_t *) calloc(1, sizeof(Identity_t));
    1.17      assert(result);
    1.18      if (!result)
    1.19          return NULL;
    1.20 @@ -60,13 +61,14 @@
    1.21      return NULL;
    1.22  }
    1.23  
    1.24 -pEp_identity *Identity_to_Struct(Identity_t *ident)
    1.25 +pEp_identity *Identity_to_Struct(Identity_t *ident, pEp_identity *result)
    1.26  {
    1.27      assert(ident);
    1.28      if (!ident)
    1.29          return NULL;
    1.30      
    1.31 -    pEp_identity *result = new_identity(NULL, NULL, NULL, NULL);
    1.32 +    if (!result)
    1.33 +        result = new_identity(NULL, NULL, NULL, NULL);
    1.34      if (!result)
    1.35          return NULL;
    1.36  
    1.37 @@ -114,13 +116,14 @@
    1.38      return NULL;
    1.39  }
    1.40  
    1.41 -KeyList_t *KeyList_from_stringlist(const stringlist_t *list)
    1.42 +KeyList_t *KeyList_from_stringlist(const stringlist_t *list, KeyList_t *result)
    1.43  {
    1.44      assert(list);
    1.45      if (!list)
    1.46          return NULL;
    1.47  
    1.48 -    KeyList_t *result = (KeyList_t *) calloc(1, sizeof(KeyList_t));
    1.49 +    if (!result)
    1.50 +        result = (KeyList_t *) calloc(1, sizeof(KeyList_t));
    1.51      assert(result);
    1.52      if (!result)
    1.53          return NULL;
    1.54 @@ -143,13 +146,14 @@
    1.55      return NULL;
    1.56  }
    1.57  
    1.58 -stringlist_t *KeyList_to_stringlist(KeyList_t *list)
    1.59 +stringlist_t *KeyList_to_stringlist(KeyList_t *list, stringlist_t *result)
    1.60  {
    1.61      assert(list);
    1.62      if (!list)
    1.63          return NULL;
    1.64  
    1.65 -    stringlist_t *result = new_stringlist(NULL);
    1.66 +    if (!result)
    1.67 +        result = new_stringlist(NULL);
    1.68      if (!result)
    1.69          return NULL;
    1.70