aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-01 14:53:14 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-01 14:53:14 +0200
commitc98bf47a8fc54e1dc9e413c0cb4506789a9ddeee (patch)
tree68cdc1d20e77802a5bbe0c2da3219ccd48fc2a88
parent06f45b04aaa8a9832599035cafee142f09700b9b (diff)
downloadgnunet-c98bf47a8fc54e1dc9e413c0cb4506789a9ddeee.tar.gz
gnunet-c98bf47a8fc54e1dc9e413c0cb4506789a9ddeee.zip
PQ: fix notification API bugs
-rw-r--r--src/pq/pq_event.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c
index e1134a5fa..bf845db18 100644
--- a/src/pq/pq_event.c
+++ b/src/pq/pq_event.c
@@ -192,6 +192,7 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db)
192 192
193 GNUNET_assert (0 == 193 GNUNET_assert (0 ==
194 pthread_mutex_lock (&db->notify_lock)); 194 pthread_mutex_lock (&db->notify_lock));
195 PQconsumeInput (db->conn);
195 while (NULL != (n = PQnotifies (db->conn))) 196 while (NULL != (n = PQnotifies (db->conn)))
196 { 197 {
197 struct GNUNET_ShortHashCode sh; 198 struct GNUNET_ShortHashCode sh;
@@ -208,6 +209,7 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db)
208 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 209 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
209 "Ignoring notification for unsupported channel identifier `%s'\n", 210 "Ignoring notification for unsupported channel identifier `%s'\n",
210 n->relname); 211 n->relname);
212 PQfreemem (n);
211 continue; 213 continue;
212 } 214 }
213 if ( (NULL != n->extra) && 215 if ( (NULL != n->extra) &&
@@ -221,12 +223,14 @@ GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db)
221 "Ignoring notification for unsupported extra data `%s' on channel `%s'\n", 223 "Ignoring notification for unsupported extra data `%s' on channel `%s'\n",
222 n->extra, 224 n->extra,
223 n->relname); 225 n->relname);
226 PQfreemem (n);
224 continue; 227 continue;
225 } 228 }
226 GNUNET_CONTAINER_multishortmap_iterate (db->channel_map, 229 GNUNET_CONTAINER_multishortmap_iterate (db->channel_map,
227 &do_notify, 230 &do_notify,
228 &ctx); 231 &ctx);
229 GNUNET_free (ctx.extra); 232 GNUNET_free (ctx.extra);
233 PQfreemem (n);
230 } 234 }
231 GNUNET_assert (0 == 235 GNUNET_assert (0 ==
232 pthread_mutex_unlock (&db->notify_lock)); 236 pthread_mutex_unlock (&db->notify_lock));