aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-21 20:11:20 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-21 20:14:51 +0100
commit6ffe3aeeacef611c3c34d18fd6b74763ca013b7c (patch)
treec813dbf855b0e7f22f80d62d92b105e2bfbafc15
parenta1ea03e3ac15bf02d6772d3207059957cbfce0e8 (diff)
handle errors without crashing
-rw-r--r--src/namestore/test_namestore_api_remove.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index c6c439e866..2d670c1ee4 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -98,19 +98,22 @@ remove_cont (void *cls,
int32_t success,
const char *emsg)
{
+ nsqe = NULL;
if (GNUNET_YES != success)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Records could not be removed: `%s'\n"), emsg);
- if (endbadly_task != NULL)
+ _("Records could not be removed: `%s'\n"),
+ emsg);
+ if (NULL != endbadly_task)
GNUNET_SCHEDULER_cancel (endbadly_task);
- endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
+ endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly,
+ NULL);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Records were removed, perform lookup\n");
removed = GNUNET_YES;
- if (endbadly_task != NULL)
+ if (NULL != endbadly_task)
GNUNET_SCHEDULER_cancel (endbadly_task);
GNUNET_SCHEDULER_add_now (&end, NULL);
}
@@ -139,8 +142,11 @@ put_cont (void *cls, int32_t success,
"Name store added record for `%s': %s\n",
name,
(success == GNUNET_OK) ? "SUCCESS" : "FAIL");
- nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name,
- 0, NULL, &remove_cont, (void *) name);
+ nsqe = GNUNET_NAMESTORE_records_store (nsh,
+ privkey,
+ name,
+ 0, NULL,
+ &remove_cont, (void *) name);
}