|
|
Re: [PATCH] iproute2: Fix memory hog of ip batched command. |
On Thu, 12 Jul 2012 18:21:06 -0700
Pravin B Shelar <pshelar@xxxxxxxxxx> wrote:
> ipaddr_list_or_flush() builds list of all device at start of
> every flush or list operation, but does not free memory at end.
> This can hog lot of memory for large batched command.
> Following patch fixes it.
>
> Reported-by: Justin Pettit <jpettit@xxxxxxxxxx>
> Signed-off-by: Pravin B Shelar <pshelar@xxxxxxxxxx>
Given all the conditional's and goto's this introduces, I prefer to
refactor the code to split up the large function.
There is an additional leak here where element is pruned from list and not freed.
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 1db7fd0..5e03d1e 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1011,9 +1011,10 @@ flush_done:
ok = 1;
break;
}
- if (!ok)
+ if (!ok) {
*lp = l->next;
- else
+ free(l);
+ } else
lp = &l->next;
}
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Kernel Discussion] [Ethernet Bridging] [Linux Wireless Networking] [Linux Bluetooth Networking] [Linux Networking Users] [VLAN] [Git] [IETF Annouce] [Linux Assembly] [Security] [Bugtraq] [Photo] [Singles Social Networking] [Yosemite Information] [MIPS Linux] [ARM Linux Kernel] [ARM Linux] [Linux Virtualization] [Linux Security] [Linux IDE] [Linux RAID] [Linux SCSI] [Free Dating]
![]() |
![]() |