[ULOGD RFC 28/30] NFCT: fix start/stop handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Free sequence cache too.

Signed-off-by: Holger Eitzenberger <holger@xxxxxxxxxxxxxxxx>

Index: ulogd-netfilter/input/flow/ulogd_inpflow_NFCT.c
===================================================================
--- ulogd-netfilter.orig/input/flow/ulogd_inpflow_NFCT.c
+++ ulogd-netfilter/input/flow/ulogd_inpflow_NFCT.c
@@ -526,6 +526,9 @@ cache_free(struct cache *c)
 {
 	int i;
 
+	if (c == NULL)
+		return;
+
 	for (i = 0; i < c->c_num_heads; i++) {
 		struct llist_head *ptr, *ptr2;
 
@@ -1079,7 +1082,7 @@ nfct_start(struct ulogd_pluginstance *up
 	ulogd_log(ULOGD_DEBUG, "%s: ctnetlink connection opened\n", upi->id);
 
     if (set_sockbuf_len(nfct_fd(priv->cth), RCVBUF_LEN, SNDBUF_LEN) < 0)
-	        goto err_free;
+	        goto err_nfct_close;
 
 	priv->nfct_fd.fd = nfct_fd(priv->cth);
 	priv->nfct_fd.cb = &read_cb_nfct;
@@ -1110,6 +1113,8 @@ nfct_start(struct ulogd_pluginstance *up
  err_free:
 	cache_free(priv->tcache);
 	priv->tcache = NULL;
+	cache_free(priv->scache);
+	priv->tcache = NULL;
 
 	return -1;
 }
@@ -1138,10 +1143,10 @@ nfct_stop(struct ulogd_pluginstance *pi)
 
 	ulogd_log(ULOGD_DEBUG, "%s: ctnetlink connection closed\n", pi->id);
 
-	if (priv->tcache != NULL) {
-		cache_free(priv->tcache);
-		priv->tcache = NULL;
-	}
+	cache_free(priv->tcache);
+	priv->tcache = NULL;
+	cache_free(priv->scache);
+	priv->scache = NULL;
 
 	return 0;
 }

-- 
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux