commit 9bec95fe28aa83f03f1a5bac25201b037e9564d3
parent fd1cac5c4dd4dc121062a214e19bbd9585af943d
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 2 Apr 2021 15:25:14 +0200
properly handle instance already exists case (#6812)
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -123,6 +123,8 @@ free_mi (struct TMH_MerchantInstance *mi)
}
GNUNET_free (mi->settings.id);
GNUNET_free (mi->settings.name);
+ json_decref (mi->settings.address);
+ json_decref (mi->settings.jurisdiction);
GNUNET_free (mi);
}
@@ -448,9 +450,18 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
&mi->auth);
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
- GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
+ MHD_RESULT ret;
+
TMH_db->rollback (TMH_db->cls);
- goto retry;
+ if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
+ goto retry;
+ ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS,
+ is.id);
+ GNUNET_JSON_parse_free (spec);
+ free_mi (mi);
+ return ret;
}
for (struct TMH_WireMethod *wm = wm_head;
NULL != wm;