On Thu, Jan 16, 2014 at 5:35 PM, Lennart Poettering <lenn...@poettering.net> wrote: > On Mon, 06.01.14 03:35, Tom Gundersen (tome...@kemper.freedesktop.org) wrote: > >> + lease->dns = new0(struct in_addr*, len / 4 + 1); >> + if (!lease->dns) >> + return -ENOMEM; >> + >> + for (i = 0; i < len / 4; i++) { >> + lease->dns[i] = new0(struct in_addr, 1); >> + memcpy(&lease->dns[i]->s_addr, option + 4 * >> i, 4); >> + } >> + >> + lease->dns[i + 1] = NULL; > > Isn't this a bit overkill? Why not just use an array of "struct in_addr" > rather than an array of "struct in_addr*"? I mean, even if we'd ignore > the overhead of malloc() here, the code is a lot more complex, and on > 64bit you use double the memory for storing the pointer to the address > than for the actual address stored... ;-)
Fair enough :-) Fixed locally, will push soon. Cheers, Tom _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel