diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-20 10:52:32 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-20 10:52:32 +0100 |
commit | f69dbeee28ec0cacf4ed1ffc4601b59a9178c794 (patch) | |
tree | 654e98edcefbdecf1f7c7716ec52411811b84bab /src/json/json_mhd.c | |
parent | 876eacc1b52e426fb176709b813f3229766f6501 (diff) | |
download | gnunet-f69dbeee28ec0cacf4ed1ffc4601b59a9178c794.tar.gz gnunet-f69dbeee28ec0cacf4ed1ffc4601b59a9178c794.zip |
fix error handling
Diffstat (limited to 'src/json/json_mhd.c')
-rw-r--r-- | src/json/json_mhd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/json/json_mhd.c b/src/json/json_mhd.c index 3d3f003be..0cc2e92dc 100644 --- a/src/json/json_mhd.c +++ b/src/json/json_mhd.c | |||
@@ -186,24 +186,26 @@ inflate_data (struct Buffer *buf) | |||
186 | ret = inflate (&z, 0); | 186 | ret = inflate (&z, 0); |
187 | switch (ret) | 187 | switch (ret) |
188 | { | 188 | { |
189 | case Z_BUF_ERROR: | ||
190 | GNUNET_break_op (0); | ||
191 | GNUNET_break (Z_OK == inflateEnd (&z)); | ||
192 | GNUNET_free (tmp); | ||
193 | return GNUNET_JSON_PR_JSON_INVALID; | ||
189 | case Z_MEM_ERROR: | 194 | case Z_MEM_ERROR: |
190 | GNUNET_break (0); | 195 | GNUNET_break (0); |
191 | GNUNET_break (Z_OK == inflateEnd (&z)); | 196 | GNUNET_break (Z_OK == inflateEnd (&z)); |
192 | GNUNET_free (tmp); | 197 | GNUNET_free (tmp); |
193 | return GNUNET_JSON_PR_OUT_OF_MEMORY; | 198 | return GNUNET_JSON_PR_OUT_OF_MEMORY; |
194 | |||
195 | case Z_DATA_ERROR: | 199 | case Z_DATA_ERROR: |
196 | GNUNET_break_op (0); | 200 | GNUNET_break_op (0); |
197 | GNUNET_break (Z_OK == inflateEnd (&z)); | 201 | GNUNET_break (Z_OK == inflateEnd (&z)); |
198 | GNUNET_free (tmp); | 202 | GNUNET_free (tmp); |
199 | return GNUNET_JSON_PR_JSON_INVALID; | 203 | return GNUNET_JSON_PR_JSON_INVALID; |
200 | |||
201 | case Z_NEED_DICT: | 204 | case Z_NEED_DICT: |
202 | GNUNET_break_op (0); | 205 | GNUNET_break_op (0); |
203 | GNUNET_break (Z_OK == inflateEnd (&z)); | 206 | GNUNET_break (Z_OK == inflateEnd (&z)); |
204 | GNUNET_free (tmp); | 207 | GNUNET_free (tmp); |
205 | return GNUNET_JSON_PR_JSON_INVALID; | 208 | return GNUNET_JSON_PR_JSON_INVALID; |
206 | |||
207 | case Z_OK: | 209 | case Z_OK: |
208 | if ((0 < z.avail_out) && (0 == z.avail_in)) | 210 | if ((0 < z.avail_out) && (0 == z.avail_in)) |
209 | { | 211 | { |
@@ -231,7 +233,6 @@ inflate_data (struct Buffer *buf) | |||
231 | tmp = GNUNET_realloc (tmp, tmp_size); | 233 | tmp = GNUNET_realloc (tmp, tmp_size); |
232 | z.next_out = (Bytef *) &tmp[z.total_out]; | 234 | z.next_out = (Bytef *) &tmp[z.total_out]; |
233 | continue; | 235 | continue; |
234 | |||
235 | case Z_STREAM_END: | 236 | case Z_STREAM_END: |
236 | /* decompression successful, make 'tmp' the new 'data' */ | 237 | /* decompression successful, make 'tmp' the new 'data' */ |
237 | GNUNET_free (buf->data); | 238 | GNUNET_free (buf->data); |