aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-06 12:05:24 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-06 12:05:24 +0000
commit8675d5f1a8906b4255562f878e140acc0ee8fafc (patch)
tree40f140e61d6b2a5212d2aa94b7379ec0d9f03494 /src/regex/regex_api.c
parent3a56bf7aa7e6de7d096cb509054b5dab1e50d119 (diff)
-misc fixes
Diffstat (limited to 'src/regex/regex_api.c')
-rw-r--r--src/regex/regex_api.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/regex/regex_api.c b/src/regex/regex_api.c
index b22d78b905..afc028cdbd 100644
--- a/src/regex/regex_api.c
+++ b/src/regex/regex_api.c
@@ -134,7 +134,10 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg,
a->cfg = cfg;
a->client = GNUNET_CLIENT_connect ("regex", cfg);
if (NULL == a->client)
+ {
+ GNUNET_free (a);
return NULL;
+ }
a->msg.header.type = htons (GNUNET_MESSAGE_TYPE_REGEX_ANNOUNCE);
a->msg.header.size = htons (slen + sizeof (struct AnnounceMessage));
a->msg.compression = htons (compression);
@@ -299,11 +302,14 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg,
size_t slen;
slen = strlen (string) + 1;
- s = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Search));
+ s = GNUNET_new (struct GNUNET_REGEX_Search);
s->cfg = cfg;
s->client = GNUNET_CLIENT_connect ("regex", cfg);
if (NULL == s->client)
+ {
+ GNUNET_free (s);
return NULL;
+ }
s->callback = callback;
s->callback_cls = callback_cls;
s->msg = GNUNET_malloc (sizeof (struct SearchMessage) + slen);