]> granicus.if.org Git - sudo/commitdiff
free(3) is already void, no need to cast it
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 10 Apr 1999 04:40:57 +0000 (04:40 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 10 Apr 1999 04:40:57 +0000 (04:40 +0000)
find_path.c
interfaces.c
lex.yy.c
parse.c
parse.lex
parse.yacc
sudo.c
sudo.tab.c
testsudoers.c
tgetpass.c
visudo.c

index 5d1d0cc36c698bdb87a074f7b5dd735f01aa7cd7..8fea324d8e3849d669d9942bdbb243230c9650be 100644 (file)
@@ -152,7 +152,7 @@ int find_path(infile, outfile)
        path = n + 1;
 
     } while (n);
-    (void) free(origpath);
+    free(origpath);
 
     /*
      * Check current dir if dot was in the PATH
index aa583a61b881c83182a1ee5db40258fb45c3622e..93d3ea4e3764bbeb9ef9c9a8115db38c3ce5110e 100644 (file)
@@ -128,7 +128,7 @@ void load_interfaces()
 #else
        if (ioctl(sock, SIOCGIFCONF, (caddr_t) ifconf) < 0) {
 #endif /* _ISC */
-           (void) free(ifconf_buf);
+           free(ifconf_buf);
            (void) close(sock);
            return;
        }
@@ -231,9 +231,9 @@ void load_interfaces()
            interfaces = (struct interface *) erealloc(interfaces,
                sizeof(struct interface) * num_interfaces);
        else
-           (void) free(interfaces);
+           free(interfaces);
     }
-    (void) free(ifconf_buf);
+    free(ifconf_buf);
     (void) close(sock);
 }
 
index cab2beba92828ce07c9c2d611e270c35ad64bb21..663ef3dd6d2cacf6011fac99e2fca9b0cf7f1961 100644 (file)
--- a/lex.yy.c
+++ b/lex.yy.c
@@ -2055,7 +2055,7 @@ static void fill_args(s, len, addspace)
                ;
 
            if ((p = (char *) realloc(yylval.command.args, arg_size)) == NULL) {
-               (void) free(yylval.command.args);
+               free(yylval.command.args);
                yyerror("unable to allocate memory");
            } else
                yylval.command.args = p;
diff --git a/parse.c b/parse.c
index 97e4d033bc97ee0ca75feddcbd01a8f8ac6cccb9..49031e3faabffc77f1f0c9a4c263849406f84c70 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -425,7 +425,7 @@ int netgr_matches(netgr, host, user)
     if (domain == (char *) -1) {
        domain = (char *) emalloc(MAXHOSTNAMELEN);
        if (getdomainname(domain, MAXHOSTNAMELEN) == -1 || *domain == '\0') {
-           (void) free(domain);
+           free(domain);
            domain = NULL;
        }
     }
index d85049dd7ad05e5029060af0a81acef5a4e54929..28bd80bc76c86703dec6e6c6963033f519de1246 100644 (file)
--- a/parse.lex
+++ b/parse.lex
@@ -330,7 +330,7 @@ static void fill_args(s, len, addspace)
                ;
 
            if ((p = (char *) realloc(yylval.command.args, arg_size)) == NULL) {
-               (void) free(yylval.command.args);
+               free(yylval.command.args);
                yyerror("unable to allocate memory");
            } else
                yylval.command.args = p;
index 760abc4a909420ae6d3b4ca29ab2ea928c87994b..a8bc13da9e3f2c14fb944bd3da0dce3764faa97e 100644 (file)
@@ -259,29 +259,29 @@ hostspec  :       ALL {
                |       NTWKADDR {
                            if (addr_matches($1))
                                host_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       NETGROUP {
                            if (netgr_matches($1, host, NULL))
                                host_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       NAME {
                            if (strcasecmp(shost, $1) == 0)
                                host_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       FQHOST {
                            if (strcasecmp(host, $1) == 0)
                                host_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       ALIAS {
                            /* could be an all-caps hostname */
                            if (find_alias($1, HOST_ALIAS) == TRUE ||
                                strcasecmp(shost, $1) == 0)
                                host_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                ;
 
@@ -382,7 +382,7 @@ runasuser   :       NAME {
                                append($1, &cm_list[cm_list_len].runas,
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
-                           (void) free($1);
+                           free($1);
                        }
                |       USERGROUP {
                            runas_matches = usergr_matches($1, runas_user);
@@ -396,7 +396,7 @@ runasuser   :       NAME {
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
                            }
-                           (void) free($1);
+                           free($1);
                        }
                |       NETGROUP {
                            runas_matches = netgr_matches($1, NULL, runas_user);
@@ -410,7 +410,7 @@ runasuser   :       NAME {
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
                            }
-                           (void) free($1);
+                           free($1);
                        }
                |       ALIAS {
                            /* could be an all-caps username */
@@ -428,7 +428,7 @@ runasuser   :       NAME {
                                append($1, &cm_list[cm_list_len].runas,
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
-                           (void) free($1);
+                           free($1);
                        }
                |       ALL {
                            runas_matches = TRUE;
@@ -497,7 +497,7 @@ cmnd                :       ALL {
                                cmnd_matches = TRUE;
                                $$ = TRUE;
                            }
-                           (void) free($1);
+                           free($1);
                        }
                |        COMMAND {
                            if (printmatches == TRUE && in_alias == TRUE) {
@@ -528,9 +528,9 @@ cmnd                :       ALL {
                                $$ = TRUE;
                            }
 
-                           (void) free($1.cmnd);
+                           free($1.cmnd);
                            if ($1.args)
-                               (void) free($1.args);
+                               free($1.args);
                        }
                ;
 
@@ -567,7 +567,7 @@ cmndalias   :       ALIAS {
                                add_alias($1, CMND_ALIAS) == FALSE)
                                YYERROR;
                            pop;
-                           (void) free($1);
+                           free($1);
 
                            if (printmatches == TRUE)
                                in_alias = FALSE;
@@ -595,7 +595,7 @@ runasalias  :       ALIAS {
                                add_alias($1, RUNAS_ALIAS) == FALSE)
                                YYERROR;
                            pop;
-                           (void) free($1);
+                           free($1);
 
                            if (printmatches == TRUE)
                                in_alias = FALSE;
@@ -611,7 +611,7 @@ useralias   :       ALIAS { push; } '=' userlist {
                                add_alias($1, USER_ALIAS) == FALSE)
                                YYERROR;
                            pop;
-                           (void) free($1);
+                           free($1);
                        }
                ;
 
@@ -633,24 +633,24 @@ opuser            :       user
 user           :       NAME {
                            if (strcmp($1, user_name) == 0)
                                user_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       USERGROUP {
                            if (usergr_matches($1, user_name))
                                user_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       NETGROUP {
                            if (netgr_matches($1, NULL, user_name))
                                user_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       ALIAS {
                            /* could be an all-caps username */
                            if (find_alias($1, USER_ALIAS) == TRUE ||
                                strcmp($1, user_name) == 0)
                                user_matches = TRUE;
-                           (void) free($1);
+                           free($1);
                        }
                |       ALL {
                            user_matches = TRUE;
@@ -885,17 +885,17 @@ void list_matches()
 
     /* Be nice and free up space now that we are done. */
     for (i = 0; i < ga_list_len; i++) {
-       (void) free(ga_list[i].alias);
-       (void) free(ga_list[i].entries);
+       free(ga_list[i].alias);
+       free(ga_list[i].entries);
     }
-    (void) free(ga_list);
+    free(ga_list);
     ga_list = NULL;
 
     for (i = 0; i < cm_list_len; i++) {
-       (void) free(cm_list[i].runas);
-       (void) free(cm_list[i].cmnd);
+       free(cm_list[i].runas);
+       free(cm_list[i].cmnd);
     }
-    (void) free(cm_list);
+    free(cm_list);
     cm_list = NULL;
     cm_list_len = 0;
     cm_list_size = 0;
@@ -956,7 +956,7 @@ static void append(src, dstp, dst_len, dst_size, separator)
 void reset_aliases()
 {
     if (aliases) {
-       (void) free(aliases);
+       free(aliases);
        aliases = NULL;
     }
     naliases = nslots = 0;
@@ -1018,7 +1018,7 @@ void init_parser()
 {
     /* Free up old data structures if we run the parser more than once. */
     if (match) {
-       (void) free(match);
+       free(match);
        match = NULL;
        top = 0;
        parse_error = FALSE;
diff --git a/sudo.c b/sudo.c
index 98ef37419c05f836060446678117ca6988c93337..2df77a1ba24f0107f43a771e205fb2ca4d7593dd 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -763,7 +763,7 @@ static void add_env(contiguous)
        exit(1);
     }
     if (NewArgc > 1)
-       (void) free(buf);
+       free(buf);
 
     /* grab a pointer to the flat arg string from the environment */
     if (NewArgc > 1 && (cmnd_args = getenv("SUDO_COMMAND"))) {
index d8941ad475ef99521038dbb12d7ffa28f9ac3e3a..6de5ac87e34508dd6de4130a2767b57e06f5dbbc 100644 (file)
@@ -725,17 +725,17 @@ void list_matches()
 
     /* Be nice and free up space now that we are done. */
     for (i = 0; i < ga_list_len; i++) {
-       (void) free(ga_list[i].alias);
-       (void) free(ga_list[i].entries);
+       free(ga_list[i].alias);
+       free(ga_list[i].entries);
     }
-    (void) free(ga_list);
+    free(ga_list);
     ga_list = NULL;
 
     for (i = 0; i < cm_list_len; i++) {
-       (void) free(cm_list[i].runas);
-       (void) free(cm_list[i].cmnd);
+       free(cm_list[i].runas);
+       free(cm_list[i].cmnd);
     }
-    (void) free(cm_list);
+    free(cm_list);
     cm_list = NULL;
     cm_list_len = 0;
     cm_list_size = 0;
@@ -796,7 +796,7 @@ static void append(src, dstp, dst_len, dst_size, separator)
 void reset_aliases()
 {
     if (aliases) {
-       (void) free(aliases);
+       free(aliases);
        aliases = NULL;
     }
     naliases = nslots = 0;
@@ -858,7 +858,7 @@ void init_parser()
 {
     /* Free up old data structures if we run the parser more than once. */
     if (match) {
-       (void) free(match);
+       free(match);
        match = NULL;
        top = 0;
        parse_error = FALSE;
@@ -1130,7 +1130,7 @@ case 18:
 {
                            if (addr_matches(yyvsp[0].string))
                                host_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 19:
@@ -1138,7 +1138,7 @@ case 19:
 {
                            if (netgr_matches(yyvsp[0].string, host, NULL))
                                host_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 20:
@@ -1146,7 +1146,7 @@ case 20:
 {
                            if (strcasecmp(shost, yyvsp[0].string) == 0)
                                host_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 21:
@@ -1154,7 +1154,7 @@ case 21:
 {
                            if (strcasecmp(host, yyvsp[0].string) == 0)
                                host_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 22:
@@ -1164,7 +1164,7 @@ case 22:
                            if (find_alias(yyvsp[0].string, HOST_ALIAS) == TRUE ||
                                strcasecmp(shost, yyvsp[0].string) == 0)
                                host_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 25:
@@ -1280,7 +1280,7 @@ case 36:
                                append(yyvsp[0].string, &cm_list[cm_list_len].runas,
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 37:
@@ -1297,7 +1297,7 @@ case 37:
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
                            }
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 38:
@@ -1314,7 +1314,7 @@ case 38:
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
                            }
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 39:
@@ -1335,7 +1335,7 @@ case 39:
                                append(yyvsp[0].string, &cm_list[cm_list_len].runas,
                                       &cm_list[cm_list_len].runas_len,
                                       &cm_list[cm_list_len].runas_size, 0);
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 40:
@@ -1418,7 +1418,7 @@ case 45:
                                cmnd_matches = TRUE;
                                yyval.BOOLEAN = TRUE;
                            }
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 46:
@@ -1452,9 +1452,9 @@ case 46:
                                yyval.BOOLEAN = TRUE;
                            }
 
-                           (void) free(yyvsp[0].command.cmnd);
+                           free(yyvsp[0].command.cmnd);
                            if (yyvsp[0].command.args)
-                               (void) free(yyvsp[0].command.args);
+                               free(yyvsp[0].command.args);
                        }
 break;
 case 49:
@@ -1489,7 +1489,7 @@ case 56:
                                add_alias(yyvsp[-3].string, CMND_ALIAS) == FALSE)
                                YYERROR;
                            pop;
-                           (void) free(yyvsp[-3].string);
+                           free(yyvsp[-3].string);
 
                            if (printmatches == TRUE)
                                in_alias = FALSE;
@@ -1518,7 +1518,7 @@ case 62:
                                add_alias(yyvsp[-3].string, RUNAS_ALIAS) == FALSE)
                                YYERROR;
                            pop;
-                           (void) free(yyvsp[-3].string);
+                           free(yyvsp[-3].string);
 
                            if (printmatches == TRUE)
                                in_alias = FALSE;
@@ -1535,7 +1535,7 @@ case 66:
                                add_alias(yyvsp[-3].string, USER_ALIAS) == FALSE)
                                YYERROR;
                            pop;
-                           (void) free(yyvsp[-3].string);
+                           free(yyvsp[-3].string);
                        }
 break;
 case 67:
@@ -1563,7 +1563,7 @@ case 72:
 {
                            if (strcmp(yyvsp[0].string, user_name) == 0)
                                user_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 73:
@@ -1571,7 +1571,7 @@ case 73:
 {
                            if (usergr_matches(yyvsp[0].string, user_name))
                                user_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 74:
@@ -1579,7 +1579,7 @@ case 74:
 {
                            if (netgr_matches(yyvsp[0].string, NULL, user_name))
                                user_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 75:
@@ -1589,7 +1589,7 @@ case 75:
                            if (find_alias(yyvsp[0].string, USER_ALIAS) == TRUE ||
                                strcmp(yyvsp[0].string, user_name) == 0)
                                user_matches = TRUE;
-                           (void) free(yyvsp[0].string);
+                           free(yyvsp[0].string);
                        }
 break;
 case 76:
index ee2b20283e9881025c8e01ea5e6af1181007d785..8f03721b5e63e940a25d21c770bce996d838e108 100644 (file)
@@ -253,7 +253,7 @@ int netgr_matches(netgr, host, user)
        domain = (char *) emalloc(MAXHOSTNAMELEN);
 
        if (getdomainname(domain, MAXHOSTNAMELEN) != 0 || *domain == '\0') {
-           (void) free(domain);
+           free(domain);
            domain = NULL;
        }
     }
index 468baee8f9d9455380b03cecd3c9e7aa75bcde11..6986a85e7b0ca515e7b954078e48ca42ce454677 100644 (file)
@@ -210,7 +210,7 @@ char * tgetpass(prompt, timeout)
            if (buf[n - 1] == '\n')
                buf[n - 1] = '\0';
        }
-       (void) free(readfds);
+       free(readfds);
     } else {
        buf[0] = '\0';
        if (fgets(buf, sizeof(buf), input)) {
index 7b6cbd0080dcaa5d3f128d6932152cad6a6ca1a1..b3971df692266d7ef9efe11123afc5de7b8fb4f4 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -350,7 +350,7 @@ int main(argc, argv)
                               Argv[0], tmpbuf, sudoers);
                Exit(-1);
            }
-           (void) free(tmpbuf);
+           free(tmpbuf);
        } else {
            (void) fprintf(stderr, "%s: Error renaming %s, %s unchanged: ",
                                   Argv[0], stmp, sudoers);