summaryrefslogtreecommitdiffstats
path: root/src/sync-alarm.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-01-04 14:16:57 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-01-04 14:19:17 +0100
commit8da00687d65f06160827e4cd469c330d3a73a9d9 (patch)
tree3a96c0c925cdb0a3262f7d41be74e686bc3f24e7 /src/sync-alarm.c
parent7bb73190b8702a57041ea7280455b078c987d886 (diff)
conntrackd: fix checking of return value of queue_add()
Most callers of queue_add() assume that it returns != 0 in case of success. However, it may return -1 in case that the queue gets full. In that case, most callers have to: - release the object that they want to enqueue. - decrement the refcount, in case they have bumped it. However, most of these callers are using the tx_queue which currently has no limit in size at all. This fix is necessary in case that I decide to limit the size of the transmission queue in the future (which makes a lot of sense indeed). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-alarm.c')
-rw-r--r--src/sync-alarm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sync-alarm.c b/src/sync-alarm.c
index 0fc7943..b555dd5 100644
--- a/src/sync-alarm.c
+++ b/src/sync-alarm.c
@@ -111,7 +111,7 @@ static void alarm_enqueue(struct cache_object *obj, int query)
{
struct cache_alarm *ca =
cache_get_extra(STATE(mode)->internal->data, obj);
- if (queue_add(STATE_SYNC(tx_queue), &ca->qnode))
+ if (queue_add(STATE_SYNC(tx_queue), &ca->qnode) > 0)
cache_object_get(obj);
}