about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/setipv4sourcefilter.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/setipv4sourcefilter.c')
-rw-r--r--sysdeps/unix/sysv/linux/setipv4sourcefilter.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/setipv4sourcefilter.c b/sysdeps/unix/sysv/linux/setipv4sourcefilter.c
index aef7f8b205..07d6da0082 100644
--- a/sysdeps/unix/sysv/linux/setipv4sourcefilter.c
+++ b/sysdeps/unix/sysv/linux/setipv4sourcefilter.c
@@ -33,17 +33,17 @@ setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
   /* We have to create an struct ip_msfilter object which we can pass
      to the kernel.  */
   size_t needed = IP_MSFILTER_SIZE (numsrc);
-  int use_malloc = __libc_use_alloca (needed);
+  int use_alloca = __libc_use_alloca (needed);
 
   struct ip_msfilter *imsf;
-  if (use_malloc)
+  if (use_alloca)
+    imsf = (struct ip_msfilter *) alloca (needed);
+  else
     {
       imsf = (struct ip_msfilter *) malloc (needed);
       if (imsf == NULL)
 	return -1;
     }
-  else
-    imsf = (struct ip_msfilter *) alloca (needed);
 
   imsf->imsf_multiaddr = group;
   imsf->imsf_interface = interface;
@@ -53,7 +53,7 @@ setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
 
   int result = __setsockopt (s, SOL_IP, IP_MSFILTER, imsf, needed);
 
-  if (use_malloc)
+  if (! use_alloca)
     {
       int save_errno = errno;
       free (imsf);