aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-10 10:54:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-10 10:54:28 +0000
commitea16c7437091f1d8fccec3cc4398621d86b97e3d (patch)
treea6b6af80c28660d768022ccdddcb5efec3f160b7 /src/identity/identity_api.c
parentdc09ad5a6eb13cd4a20d56af2170f16d53d19bcf (diff)
downloadgnunet-ea16c7437091f1d8fccec3cc4398621d86b97e3d.tar.gz
gnunet-ea16c7437091f1d8fccec3cc4398621d86b97e3d.zip
-do not crash if cb was NULL on ego free
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 87ed361c4..17e3cff92 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -172,6 +172,8 @@ struct GNUNET_IDENTITY_Handle
172 172
173/** 173/**
174 * Obtain the ego representing 'anonymous' users. 174 * Obtain the ego representing 'anonymous' users.
175 *
176 * @return handle for the anonymous user, must not be freed
175 */ 177 */
176const struct GNUNET_IDENTITY_Ego * 178const struct GNUNET_IDENTITY_Ego *
177GNUNET_IDENTITY_ego_get_anonymous () 179GNUNET_IDENTITY_ego_get_anonymous ()
@@ -448,8 +450,8 @@ transmit_next (struct GNUNET_IDENTITY_Handle *h);
448/** 450/**
449 * Transmit next message to service. 451 * Transmit next message to service.
450 * 452 *
451 * @param cls the 'struct GNUNET_IDENTITY_Handle'. 453 * @param cls the `struct GNUNET_IDENTITY_Handle`.
452 * @param size number of bytes available in buf 454 * @param size number of bytes available in @a buf
453 * @param buf where to copy the message 455 * @param buf where to copy the message
454 * @return number of bytes copied to buf 456 * @return number of bytes copied to buf
455 */ 457 */
@@ -558,7 +560,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
558 * 560 *
559 * @param cfg the configuration to use 561 * @param cfg the configuration to use
560 * @param cb function to call on all identity events, can be NULL 562 * @param cb function to call on all identity events, can be NULL
561 * @param cb_cls closure for 'cb' 563 * @param cb_cls closure for @a cb
562 * @return handle to use 564 * @return handle to use
563 */ 565 */
564struct GNUNET_IDENTITY_Handle * 566struct GNUNET_IDENTITY_Handle *
@@ -614,7 +616,7 @@ GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
614 * @param id identity service to query 616 * @param id identity service to query
615 * @param service_name for which service is an identity wanted 617 * @param service_name for which service is an identity wanted
616 * @param cb function to call with the result (will only be called once) 618 * @param cb function to call with the result (will only be called once)
617 * @param cb_cls closure for cb 619 * @param cb_cls closure for @a cb
618 * @return handle to abort the operation 620 * @return handle to abort the operation
619 */ 621 */
620struct GNUNET_IDENTITY_Operation * 622struct GNUNET_IDENTITY_Operation *
@@ -663,7 +665,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *id,
663 * @param service_name for which service is an identity set 665 * @param service_name for which service is an identity set
664 * @param ego new default identity to be set for this service 666 * @param ego new default identity to be set for this service
665 * @param cont function to call once the operation finished 667 * @param cont function to call once the operation finished
666 * @param cont_cls closure for cont 668 * @param cont_cls closure for @a cont
667 * @return handle to abort the operation 669 * @return handle to abort the operation
668 */ 670 */
669struct GNUNET_IDENTITY_Operation * 671struct GNUNET_IDENTITY_Operation *
@@ -713,7 +715,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *id,
713 * @param id identity service to use 715 * @param id identity service to use
714 * @param name desired name 716 * @param name desired name
715 * @param cont function to call with the result (will only be called once) 717 * @param cont function to call with the result (will only be called once)
716 * @param cont_cls closure for cont 718 * @param cont_cls closure for @a cont
717 * @return handle to abort the operation 719 * @return handle to abort the operation
718 */ 720 */
719struct GNUNET_IDENTITY_Operation * 721struct GNUNET_IDENTITY_Operation *
@@ -768,7 +770,7 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
768 * @param old_name old name 770 * @param old_name old name
769 * @param new_name desired new name 771 * @param new_name desired new name
770 * @param cb function to call with the result (will only be called once) 772 * @param cb function to call with the result (will only be called once)
771 * @param cb_cls closure for cb 773 * @param cb_cls closure for @a cb
772 * @return handle to abort the operation 774 * @return handle to abort the operation
773 */ 775 */
774struct GNUNET_IDENTITY_Operation * 776struct GNUNET_IDENTITY_Operation *
@@ -923,10 +925,11 @@ free_ego (void *cls,
923 struct GNUNET_IDENTITY_Handle *h = cls; 925 struct GNUNET_IDENTITY_Handle *h = cls;
924 struct GNUNET_IDENTITY_Ego *ego = value; 926 struct GNUNET_IDENTITY_Ego *ego = value;
925 927
926 h->cb (h->cb_cls, 928 if (NULL != h->cb)
927 ego, 929 h->cb (h->cb_cls,
928 &ego->ctx, 930 ego,
929 NULL); 931 &ego->ctx,
932 NULL);
930 GNUNET_free (ego->pk); 933 GNUNET_free (ego->pk);
931 GNUNET_free (ego->name); 934 GNUNET_free (ego->name);
932 GNUNET_free (ego); 935 GNUNET_free (ego);