문제

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?

도움이 되었습니까?

해결책

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:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top