diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-10 11:35:02 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-10 11:35:27 +0200 |
commit | d3245124b4b2918c6dbd64aa237e96d96279e48b (patch) | |
tree | 73907ac010f4f5483401d3fc240da51c67dfca5f /src | |
parent | f3e122bcb96dde2d406a6005013d96e67a045cd3 (diff) | |
download | gnunet-d3245124b4b2918c6dbd64aa237e96d96279e48b.tar.gz gnunet-d3245124b4b2918c6dbd64aa237e96d96279e48b.zip |
fix crash on monitor disconnect
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index a92b8104a..ffc76a911 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -918,6 +918,8 @@ client_disconnect_cb (void *cls, | |||
918 | client); | 918 | client); |
919 | for (struct ZoneMonitor *zm = monitor_head; NULL != zm; zm = zm->next) | 919 | for (struct ZoneMonitor *zm = monitor_head; NULL != zm; zm = zm->next) |
920 | { | 920 | { |
921 | struct StoreActivity *san; | ||
922 | |||
921 | if (nc != zm->nc) | 923 | if (nc != zm->nc) |
922 | continue; | 924 | continue; |
923 | GNUNET_CONTAINER_DLL_remove (monitor_head, | 925 | GNUNET_CONTAINER_DLL_remove (monitor_head, |
@@ -928,11 +930,13 @@ client_disconnect_cb (void *cls, | |||
928 | GNUNET_SCHEDULER_cancel (zm->task); | 930 | GNUNET_SCHEDULER_cancel (zm->task); |
929 | zm->task = NULL; | 931 | zm->task = NULL; |
930 | } | 932 | } |
931 | for (struct StoreActivity *sa = sa_head; NULL != sa; sa = sa->next) | 933 | for (struct StoreActivity *sa = sa_head; NULL != sa; sa = san) |
932 | { | 934 | { |
935 | san = sa->next; | ||
933 | if (zm == sa->zm_pos) | 936 | if (zm == sa->zm_pos) |
934 | { | 937 | { |
935 | sa->zm_pos = zm->next; | 938 | sa->zm_pos = zm->next; |
939 | /* this may free sa */ | ||
936 | continue_store_activity (sa); | 940 | continue_store_activity (sa); |
937 | } | 941 | } |
938 | } | 942 | } |
@@ -943,6 +947,7 @@ client_disconnect_cb (void *cls, | |||
943 | { | 947 | { |
944 | if (sa->nc == nc) | 948 | if (sa->nc == nc) |
945 | { | 949 | { |
950 | /* this may free sa */ | ||
946 | free_store_activity (sa); | 951 | free_store_activity (sa); |
947 | break; /* there can only be one per nc */ | 952 | break; /* there can only be one per nc */ |
948 | } | 953 | } |