Question

static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
    .forwarding     = 0,
    .hop_limit      = IPV6_DEFAULT_HOPLIMIT,
    .mtu6           = IPV6_MIN_MTU,
};

static int __net_init addrconf_init_net(struct net *net)
{
    struct ipv6_devconf *dflt;
    dflt = &ipv6_devconf_dflt;
    kfree(dflt);
}

ipv6_devconf_dflt is a static structure variable. Address of ipv6_devconf_dflt is assigned to local variable. which is then freed using kfree().

Is it allowed to free non-heap memory?

Was it helpful?

Solution

No—it doesn't make sense to free memory outside the heap, because kfree() only works to free up memory in the context of kmalloc()ed chunks!

Timeline:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top