aboutsummaryrefslogtreecommitdiff
path: root/src/json/json_gnsrecord.c
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-08-08 23:24:10 +0200
committerPhil <phil.buschmann@tum.de>2018-08-08 23:24:10 +0200
commit0d239903075f518edef85277f13d1b5d303443bf (patch)
tree915dd42806aee47625ffed4bce82be9476e5bd36 /src/json/json_gnsrecord.c
parent9eb2df3407246f984f0d85af338bff872d5e6fba (diff)
downloadgnunet-0d239903075f518edef85277f13d1b5d303443bf.tar.gz
gnunet-0d239903075f518edef85277f13d1b5d303443bf.zip
Namestore Rest API finished
Diffstat (limited to 'src/json/json_gnsrecord.c')
-rw-r--r--src/json/json_gnsrecord.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/json/json_gnsrecord.c b/src/json/json_gnsrecord.c
index 4f6d30748..7bdf97f06 100644
--- a/src/json/json_gnsrecord.c
+++ b/src/json/json_gnsrecord.c
@@ -54,7 +54,7 @@ parse_gnsrecordobject (void *cls,
54 const char *record_type; 54 const char *record_type;
55 const char *label; 55 const char *label;
56 int flag; 56 int flag;
57 void *rdata; 57 void *rdata = NULL;
58 size_t rdata_size; 58 size_t rdata_size;
59 59
60 GNUNET_assert(NULL != root); 60 GNUNET_assert(NULL != root);
@@ -72,7 +72,7 @@ parse_gnsrecordobject (void *cls,
72 GNUNET_JSON_GNSRECORD_EXPIRATION_TIME, &expiration_time, 72 GNUNET_JSON_GNSRECORD_EXPIRATION_TIME, &expiration_time,
73 GNUNET_JSON_GNSRECORD_FLAG, &flag, 73 GNUNET_JSON_GNSRECORD_FLAG, &flag,
74 GNUNET_JSON_GNSRECORD_LABEL, &label); 74 GNUNET_JSON_GNSRECORD_LABEL, &label);
75 if (GNUNET_SYSERR == unpack_state) 75 if (0 != unpack_state)
76 { 76 {
77 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 77 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
78 "Error json object has a wrong format!\n"); 78 "Error json object has a wrong format!\n");
@@ -82,7 +82,8 @@ parse_gnsrecordobject (void *cls,
82 gnsrecord_object->record_type = GNUNET_GNSRECORD_typename_to_number(record_type); 82 gnsrecord_object->record_type = GNUNET_GNSRECORD_typename_to_number(record_type);
83 if (UINT32_MAX == gnsrecord_object->record_type) 83 if (UINT32_MAX == gnsrecord_object->record_type)
84 { 84 {
85 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,"Unsupported type"); 85 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,"Unsupported type\n");
86 GNUNET_free(gnsrecord_object);
86 return GNUNET_SYSERR; 87 return GNUNET_SYSERR;
87 } 88 }
88 if (GNUNET_OK 89 if (GNUNET_OK
@@ -91,7 +92,8 @@ parse_gnsrecordobject (void *cls,
91 &rdata, 92 &rdata,
92 &rdata_size)) 93 &rdata_size))
93 { 94 {
94 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,"Value invalid for record type"); 95 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,"Value invalid for record type\n");
96 GNUNET_free(gnsrecord_object);
95 return GNUNET_SYSERR; 97 return GNUNET_SYSERR;
96 } 98 }
97 99
@@ -110,7 +112,9 @@ parse_gnsrecordobject (void *cls,
110 } 112 }
111 else 113 else
112 { 114 {
113 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Expiration time invalid"); 115 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Expiration time invalid\n");
116 GNUNET_free_non_null(rdata);
117 GNUNET_free(gnsrecord_object);
114 return GNUNET_SYSERR; 118 return GNUNET_SYSERR;
115 } 119 }
116 // check if flag is a valid enum value 120 // check if flag is a valid enum value
@@ -119,7 +123,9 @@ parse_gnsrecordobject (void *cls,
119 && (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION != flag) 123 && (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION != flag)
120 && (GNUNET_GNSRECORD_RF_SHADOW_RECORD) != flag) 124 && (GNUNET_GNSRECORD_RF_SHADOW_RECORD) != flag)
121 { 125 {
122 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Flag invalid"); 126 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Flag invalid\n");
127 GNUNET_free_non_null(rdata);
128 GNUNET_free(gnsrecord_object);
123 return GNUNET_SYSERR; 129 return GNUNET_SYSERR;
124 } 130 }
125 gnsrecord_object->flags = (enum GNUNET_GNSRECORD_Flags)flag; 131 gnsrecord_object->flags = (enum GNUNET_GNSRECORD_Flags)flag;