]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Don't free static string
authorPaul Mackerras <paulus@ozlabs.org>
Sun, 1 Dec 2019 03:30:55 +0000 (14:30 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Sun, 1 Dec 2019 03:30:59 +0000 (14:30 +1100)
Commit fcb076c2 ("Various fixes for errors found by coverity static
analysis (#109)", 2019-05-06) added statements to free the result
returned from get_first_ethernet().  However, the result of
get_first_ethernet() is not dynamically allocated, either on Linux
or Solaris.  Hence this removes the unnecessary (and dangerous)
free() statements.

Fixes: fcb076c2 ("Various fixes for errors found by coverity static analysis (#109)")
Reported-by: Florian Kohnhäuser <florian@kohnhaeuser.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd/multilink.c

index eb4074d905b395bf52db30e605bc01f457a3c531..3aee0bcf6876686e73599835c483a1d585824cba 100644 (file)
@@ -445,13 +445,9 @@ get_default_epdisc(ep)
        if (p != 0 && get_if_hwaddr(ep->value, p) >= 0) {
                ep->class = EPD_MAC;
                ep->length = 6;
-               free(p);
                return 1;
        }
 
-       if (p)
-               free(p);
-
        /* see if our hostname corresponds to a reasonable IP address */
        hp = gethostbyname(hostname);
        if (hp != NULL) {