- fixes
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Tue, 15 Sep 2015 09:05:18 +0000 (09:05 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Tue, 15 Sep 2015 09:05:18 +0000 (09:05 +0000)
src/identity/plugin_rest_identity.c
src/namestore/plugin_rest_namestore.c
src/rest/rest.c

index 687908bf0d398e1c0d94d8c2035b5bbee6347d55..e3c096371757ec29e9ddc7d8e4fcebacecb62618 100644 (file)
@@ -882,7 +882,6 @@ rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle,
   handle->identity_handle = GNUNET_IDENTITY_connect (cfg,
                                                      &list_ego,
                                                      handle);
-  GNUNET_strdup ("Timeout");
   handle->timeout_task =
     GNUNET_SCHEDULER_add_delayed (handle->timeout,
                                   &do_error,
index 5ece83064c6f0847ef39e2a7526e3c446ef4749f..6ae3e7967c7b42053d8c54d163456dd0a56a9c36 100644 (file)
@@ -234,6 +234,8 @@ cleanup_handle (struct RequestHandle *handle)
   int i;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Cleaning up\n");
+  if (NULL != handle->resp_object)
+    GNUNET_REST_jsonapi_object_delete (handle->resp_object);
   if (NULL != handle->name)
     GNUNET_free (handle->name);
   if (NULL != handle->timeout_task)
@@ -384,7 +386,6 @@ namestore_list_response (void *cls,
       GNUNET_SCHEDULER_add_now (&do_error, handle);
       return;
     }
-    GNUNET_REST_jsonapi_object_delete (handle->resp_object);
     resp = GNUNET_REST_create_json_response (result);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
     GNUNET_free (result);
index 77427ef6c8bf09781fd8edf77adf7f1f208bbf7e..95a5d0605df736a778f7397e5d565425f0baf1fd 100644 (file)
@@ -407,26 +407,17 @@ GNUNET_REST_jsonapi_data_serialize (const struct JsonApiObject *resp,
     return GNUNET_SYSERR;
 
   root_json = json_object ();
-  if (0 == resp->res_count)
-  {
-    json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, json_array());
-  }
-  else if (1 == resp->res_count)
-  {
-    json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, resp->res_list_head->res_obj);
-  }
-  else
+  res_arr = json_array ();
+  for (res = resp->res_list_head; 
+       res != NULL;
+       res = res->next)
   {
-    res_arr = json_array ();
-    for (res = resp->res_list_head; 
-         res != NULL;
-         res = res->next)
-    {
-      json_array_append (res_arr, res->res_obj);
-    }
-    json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, res_arr);
+    json_array_append (res_arr, res->res_obj);
   }
+  json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, res_arr);
   *result = json_dumps (root_json, JSON_INDENT(2));
+  json_decref (root_json);
+  json_decref (res_arr);
   return GNUNET_OK;
 }
 
@@ -434,13 +425,13 @@ GNUNET_REST_jsonapi_data_serialize (const struct JsonApiObject *resp,
  * REST Utilities
  */
 
-/**
- * Check if namespace is in URL.
- *
- * @param url URL to check
- * @param namespace namespace to check against
- * @retun GNUNET_YES if namespace matches
- */
+  /**
  * Check if namespace is in URL.
  *
  * @param url URL to check
  * @param namespace namespace to check against
  * @retun GNUNET_YES if namespace matches
  */
 int
 GNUNET_REST_namespace_match (const char *url, const char *namespace)
 {