git://git.onelab.eu
/
util-vserver.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a92bd70
)
Fix memory leak.
author
Daniel Hokka Zakrisson
<dhokka@cs.princeton.edu>
Thu, 4 Oct 2007 00:47:33 +0000
(
00:47
+0000)
committer
Daniel Hokka Zakrisson
<dhokka@cs.princeton.edu>
Thu, 4 Oct 2007 00:47:33 +0000
(
00:47
+0000)
src/vip6-autod.c
patch
|
blob
|
history
diff --git
a/src/vip6-autod.c
b/src/vip6-autod.c
index
1b60aa0
..
2d48dcd
100644
(file)
--- a/
src/vip6-autod.c
+++ b/
src/vip6-autod.c
@@
-29,8
+29,8
@@
#include <asm/types.h>
/* not defined for gcc -ansi */
#include <asm/types.h>
/* not defined for gcc -ansi */
-typedef u
int64_t
__u64;
-typedef
int64_t
__s64;
+typedef u
nsigned long long
__u64;
+typedef
signed long long
__s64;
#include <netlink/netlink.h>
#include <netlink/route/addr.h>
#include <netlink/netlink.h>
#include <netlink/route/addr.h>
@@
-153,6
+153,18
@@
static void cleanup_prefix(struct prefix_list *i)
free(p);
}
free(p);
}
+static inline void free_nid_list(struct nid_list *head)
+{
+ struct nid_list *p;
+ for (p = NULL; head; head = head->next) {
+ if (p)
+ free(p);
+ p = head;
+ }
+ if (p)
+ free(p);
+}
+
static void do_slices_autoconf(struct prefix_list *head)
{
DIR *dp;
static void do_slices_autoconf(struct prefix_list *head)
{
DIR *dp;
@@
-161,6
+173,7
@@
static void do_slices_autoconf(struct prefix_list *head)
struct vc_net_nx addr;
struct prefix_list *i;
struct nid_list *current = NULL, *n;
struct vc_net_nx addr;
struct prefix_list *i;
struct nid_list *current = NULL, *n;
+ static struct nid_list *previous = NULL;
if ((dp = opendir("/proc/virtnet")) == NULL)
return;
if ((dp = opendir("/proc/virtnet")) == NULL)
return;
@@
-225,6
+238,9
@@
next:
}
}
closedir(dp);
}
}
closedir(dp);
+
+ free_nid_list(previous);
+ previous = current;
}
static int add_prefix(struct prefix_list *head, struct prefixmsg *msg,
}
static int add_prefix(struct prefix_list *head, struct prefixmsg *msg,