summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-03-24 18:07:51 +0100
committerPhil Sutter <phil@nwl.cc>2022-03-28 12:19:44 +0200
commit549f90d8a7847f201aa604a0cf7c24b73d4b5a56 (patch)
tree9b18cb987d968c1a5a2b8a5af99ec3e14911d881
parent9be65154696859d94dcdeb7347ba5cca3b8d48ba (diff)
cache: Fix features array allocation
struct cache::features is of type struct cache_feature **, allocate and populate accordingly. Fixes: ad31f852c3454 ("initial import of the conntrack daemon to Netfilter SVN") Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--src/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cache.c b/src/cache.c
index 79a024f..9bc8d0f 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -69,12 +69,12 @@ struct cache *cache_create(const char *name, enum cache_type type,
memcpy(c->feature_type, feature_type, sizeof(feature_type));
- c->features = malloc(sizeof(struct cache_feature) * j);
+ c->features = malloc(sizeof(struct cache_feature *) * j);
if (!c->features) {
free(c);
return NULL;
}
- memcpy(c->features, feature_array, sizeof(struct cache_feature) * j);
+ memcpy(c->features, feature_array, sizeof(struct cache_feature *) * j);
c->num_features = j;
c->extra_offset = size;