gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: -fix misc. leaks


From: gnunet
Subject: [taler-merchant] branch master updated: -fix misc. leaks
Date: Sun, 28 Jan 2024 23:29:07 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new a08b70f6 -fix misc. leaks
a08b70f6 is described below

commit a08b70f6244fafa2664f694cf28c0e3d128a9a0b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jan 28 23:27:32 2024 +0100

    -fix misc. leaks
---
 ...ler-merchant-httpd_private-patch-token-families-SLUG.c | 12 +++++++-----
 src/backend/taler-merchant-httpd_private-post-instances.c | 15 ++++++++++++++-
 src/backend/taler-merchant-httpd_private-post-orders.c    | 12 +++++++-----
 .../taler-merchant-httpd_private-post-token-families.c    |  9 +++++----
 4 files changed, 33 insertions(+), 15 deletions(-)

diff --git 
a/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c 
b/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c
index 8d34b2ff..c49d80d7 100644
--- a/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c
+++ b/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c
@@ -82,7 +82,7 @@ TMH_private_patch_token_family_SLUG (const struct 
TMH_RequestHandler *rh,
              : MHD_NO;
   }
 
-  struct GNUNET_TIME_Relative validity = GNUNET_TIME_absolute_get_difference(
+  struct GNUNET_TIME_Relative validity = GNUNET_TIME_absolute_get_difference (
     details.valid_after.abs_time,
     details.valid_before.abs_time);
 
@@ -98,8 +98,10 @@ TMH_private_patch_token_family_SLUG (const struct 
TMH_RequestHandler *rh,
   }
 
   if (NULL == details.description_i18n)
+  {
     details.description_i18n = json_object ();
-
+    GNUNET_assert (NULL != details.description_i18n);
+  }
   if (! TALER_JSON_check_i18n (details.description_i18n))
   {
     GNUNET_break_op (0);
@@ -136,9 +138,9 @@ TMH_private_patch_token_family_SLUG (const struct 
TMH_RequestHandler *rh,
     case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
       // TODO: Add error code for token family not found
       ret = TALER_MHD_reply_with_error (connection,
-                                       MHD_HTTP_NOT_FOUND,
-                                       0,
-                                       slug);
+                                        MHD_HTTP_NOT_FOUND,
+                                        0,
+                                        slug);
       break;
     case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
       ret = TALER_MHD_reply_static (connection,
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c 
b/src/backend/taler-merchant-httpd_private-post-instances.c
index 396008c8..a4cf884d 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -49,7 +49,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler 
*rh,
                             struct MHD_Connection *connection,
                             struct TMH_HandlerContext *hc)
 {
-  struct TALER_MERCHANTDB_InstanceSettings is;
+  struct TALER_MERCHANTDB_InstanceSettings is = { 0 };
   struct TALER_MERCHANTDB_InstanceAuthSettings ias;
   const char *auth_token = NULL;
   const char *uts = "business";
@@ -110,6 +110,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler 
*rh,
                                                 &is.ut))
   {
     GNUNET_break_op (0);
+    GNUNET_JSON_parse_free (spec);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -123,7 +124,10 @@ TMH_private_post_instances (const struct 
TMH_RequestHandler *rh,
                                  jauth,
                                  &auth_token);
     if (GNUNET_OK != ret)
+    {
+      GNUNET_JSON_parse_free (spec);
       return (GNUNET_NO == ret) ? MHD_YES : MHD_NO;
+    }
   }
 
   /* check 'id' well-formed */
@@ -146,15 +150,19 @@ TMH_private_post_instances (const struct 
TMH_RequestHandler *rh,
                       0, NULL, 0))
       id_wellformed = false;
     if (! id_wellformed)
+    {
+      GNUNET_JSON_parse_free (spec);
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_BAD_REQUEST,
                                          TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                          "id");
+    }
   }
 
   if (! TMH_location_object_valid (is.address))
   {
     GNUNET_break_op (0);
+    GNUNET_JSON_parse_free (spec);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -164,6 +172,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler 
*rh,
   if (! TMH_location_object_valid (is.jurisdiction))
   {
     GNUNET_break_op (0);
+    GNUNET_JSON_parse_free (spec);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -174,6 +183,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler 
*rh,
        (! TMH_image_data_url_valid (is.logo)) )
   {
     GNUNET_break_op (0);
+    GNUNET_JSON_parse_free (spec);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -189,6 +199,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler 
*rh,
     {
       if (mi->deleted)
       {
+        GNUNET_JSON_parse_free (spec);
         return TALER_MHD_reply_with_error (connection,
                                            MHD_HTTP_CONFLICT,
                                            
TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED,
@@ -231,12 +242,14 @@ TMH_private_post_instances (const struct 
TMH_RequestHandler *rh,
                                       ==,
                                       is.default_pay_delay)) )
       {
+        GNUNET_JSON_parse_free (spec);
         return TALER_MHD_reply_static (connection,
                                        MHD_HTTP_NO_CONTENT,
                                        NULL,
                                        NULL,
                                        0);
       }
+      GNUNET_JSON_parse_free (spec);
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_CONFLICT,
                                          
TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS,
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c 
b/src/backend/taler-merchant-httpd_private-post-orders.c
index 52c146ef..3c3f9ab8 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -1851,6 +1851,7 @@ parse_order (struct OrderContext *oc)
       if (NULL != loca)
       {
         loca = json_deep_copy (loca);
+        GNUNET_assert (NULL != loca);
         GNUNET_assert (0 ==
                        json_object_set_new (oc->parse_order.merchant,
                                             "address",
@@ -1858,17 +1859,18 @@ parse_order (struct OrderContext *oc)
       }
     }
     {
-      json_t *locj;
+      json_t *juri;
 
       /* Handle merchant jurisdiction */
-      locj = settings->jurisdiction;
-      if (NULL != locj)
+      juri = settings->jurisdiction;
+      if (NULL != juri)
       {
-        locj = json_deep_copy (locj);
+        juri = json_deep_copy (juri);
+        GNUNET_assert (NULL != juri);
         GNUNET_assert (0 ==
                        json_object_set_new (oc->parse_order.merchant,
                                             "jurisdiction",
-                                            locj));
+                                            juri));
       }
     }
   }
diff --git a/src/backend/taler-merchant-httpd_private-post-token-families.c 
b/src/backend/taler-merchant-httpd_private-post-token-families.c
index 6bf048f9..b9be59d8 100644
--- a/src/backend/taler-merchant-httpd_private-post-token-families.c
+++ b/src/backend/taler-merchant-httpd_private-post-token-families.c
@@ -86,7 +86,7 @@ TMH_private_post_token_families (const struct 
TMH_RequestHandler *rh,
       GNUNET_JSON_spec_json ("description_i18n",
                              &details.description_i18n),
       NULL),
-    GNUNET_JSON_spec_string("kind", &kind),
+    GNUNET_JSON_spec_string ("kind", &kind),
     GNUNET_JSON_spec_timestamp ("valid_after",
                                 &details.valid_after),
     GNUNET_JSON_spec_timestamp ("valid_before",
@@ -113,13 +113,14 @@ TMH_private_post_token_families (const struct 
TMH_RequestHandler *rh,
   }
 
 
-  if (strcmp(kind, "discount") == 0)
+  if (strcmp (kind, "discount") == 0)
     details.kind = TALER_MERCHANTDB_TFK_Discount;
-  else if (strcmp(kind, "subscription") == 0)
+  else if (strcmp (kind, "subscription") == 0)
     details.kind = TALER_MERCHANTDB_TFK_Subscription;
   else
   {
     GNUNET_break (0);
+    GNUNET_JSON_parse_free (spec);
     return TALER_MHD_reply_with_error (connection,
                                        MHD_HTTP_BAD_REQUEST,
                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -194,7 +195,7 @@ TMH_private_post_token_families (const struct 
TMH_RequestHandler *rh,
                                     NULL,
                                     NULL,
                                     0)
-          // TODO: Use proper error code
+               // TODO: Use proper error code
           : TALER_MHD_reply_with_error (connection,
                                         MHD_HTTP_CONFLICT,
                                         0,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]