From: Todd C. Miller Date: Sat, 10 Apr 1999 04:40:57 +0000 (+0000) Subject: free(3) is already void, no need to cast it X-Git-Tag: SUDO_1_6_0~286 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eecc5ce1c9d5b8f7a92589bc72c9325ee6d15028;p=sudo free(3) is already void, no need to cast it --- diff --git a/find_path.c b/find_path.c index 5d1d0cc36..8fea324d8 100644 --- a/find_path.c +++ b/find_path.c @@ -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 diff --git a/interfaces.c b/interfaces.c index aa583a61b..93d3ea4e3 100644 --- a/interfaces.c +++ b/interfaces.c @@ -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); } diff --git a/lex.yy.c b/lex.yy.c index cab2beba9..663ef3dd6 100644 --- 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 97e4d033b..49031e3fa 100644 --- 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; } } diff --git a/parse.lex b/parse.lex index d85049dd7..28bd80bc7 100644 --- 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; diff --git a/parse.yacc b/parse.yacc index 760abc4a9..a8bc13da9 100644 --- a/parse.yacc +++ b/parse.yacc @@ -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 98ef37419..2df77a1ba 100644 --- 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"))) { diff --git a/sudo.tab.c b/sudo.tab.c index d8941ad47..6de5ac87e 100644 --- a/sudo.tab.c +++ b/sudo.tab.c @@ -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: diff --git a/testsudoers.c b/testsudoers.c index ee2b20283..8f03721b5 100644 --- a/testsudoers.c +++ b/testsudoers.c @@ -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; } } diff --git a/tgetpass.c b/tgetpass.c index 468baee8f..6986a85e7 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -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)) { diff --git a/visudo.c b/visudo.c index 7b6cbd008..b3971df69 100644 --- 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);