Remove useless "if" before "free".

This commit is contained in:
Ulrich Drepper 2008-03-19 06:43:34 +00:00
parent 354b75277b
commit 72e6cdfa2c
19 changed files with 33 additions and 66 deletions

View File

@ -1184,7 +1184,6 @@ parse_conf_include (const char *config_file, unsigned int lineno,
break;
}
if (copy)
free (copy);
}

View File

@ -396,6 +396,5 @@ _mcleanup (void)
write_gmon ();
/* free the memory. */
if (_gmonparam.tos != NULL)
free (_gmonparam.tos);
}

View File

@ -529,7 +529,6 @@ __gconv_get_path (void)
__gconv_path_elem = result ?: (struct path_elem *) &empty_path_elem;
if (cwd != NULL)
free (cwd);
}

View File

@ -826,7 +826,6 @@ __validuser2_sa(hostf, ra, ralen, luser, ruser, rhost)
}
}
if (buf != NULL)
free (buf);
return retval;

View File

@ -203,7 +203,6 @@ set_binding_values (domainname, dirnamep, codesetp)
if (__builtin_expect (result != NULL, 1))
{
if (binding->codeset != NULL)
free (binding->codeset);
binding->codeset = result;

View File

@ -1236,7 +1236,6 @@ _nl_load_domain (domain_file, domainbinding)
/* This is an invalid revision. */
invalid:
/* This is an invalid .mo file. */
if (domain->malloced)
free (domain->malloced);
#ifdef HAVE_MMAP
if (use_mmap)
@ -1289,11 +1288,9 @@ _nl_unload_domain (domain)
if (convd->conv != (__gconv_t) -1)
__gconv_close (convd->conv);
}
if (domain->conversions != NULL)
free (domain->conversions);
__libc_rwlock_fini (domain->conversions_lock);
if (domain->malloced)
free (domain->malloced);
# ifdef _POSIX_MAPPED_FILES

View File

@ -366,7 +366,6 @@ stringprep (char *in,
do
{
if (ucs4)
free (ucs4);
ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
maxucs4len = ucs4len + adducs4len;
@ -449,7 +448,6 @@ stringprep_profile (const char *in,
do
{
if (str)
free (str);
str = (char *) malloc (len);
if (str == NULL)

View File

@ -300,7 +300,6 @@ save_for_backup (fp, end_p)
memcpy (new_buffer + avail,
fp->_IO_read_base + least_mark,
needed_size);
if (fp->_IO_save_base)
free (fp->_IO_save_base);
fp->_IO_save_base = new_buffer;
fp->_IO_save_end = new_buffer + avail + needed_size;

View File

@ -553,7 +553,6 @@ save_for_wbackup (fp, end_p)
needed_size * sizeof (wchar_t));
#endif
}
if (fp->_wide_data->_IO_save_base)
free (fp->_wide_data->_IO_save_base);
fp->_wide_data->_IO_save_base = new_buffer;
fp->_wide_data->_IO_save_end = new_buffer + avail + needed_size;

View File

@ -2963,9 +2963,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
col_elem_free:
if (symbol != NULL)
free ((char *) symbol);
if (arg->val.str.startmb != NULL)
free (arg->val.str.startmb);
if (arg->val.str.startwc != NULL)
free (arg->val.str.startwc);
}
lr_ignore_rest (ldfile, 1);
@ -3112,9 +3110,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
else
{
col_sym_free:
if (symbol != NULL)
free (symbol);
if (endsymbol != NULL)
free (endsymbol);
}
}

View File

@ -859,7 +859,6 @@ non-symbolic character value should not be used"));
if (illegal_string)
{
free (buf);
if (buf2 != NULL)
free (buf2);
lr->token.val.str.startmb = NULL;
lr->token.val.str.lenmb = 0;

View File

@ -116,15 +116,10 @@ init_nss_interface (void)
static void
give_pwd_free (struct passwd *pwd)
{
if (pwd->pw_name != NULL)
free (pwd->pw_name);
if (pwd->pw_passwd != NULL)
free (pwd->pw_passwd);
if (pwd->pw_gecos != NULL)
free (pwd->pw_gecos);
if (pwd->pw_dir != NULL)
free (pwd->pw_dir);
if (pwd->pw_shell != NULL)
free (pwd->pw_shell);
memset (pwd, '\0', sizeof (struct passwd));

View File

@ -113,9 +113,7 @@ init_nss_interface (void)
static void
give_spwd_free (struct spwd *pwd)
{
if (pwd->sp_namp != NULL)
free (pwd->sp_namp);
if (pwd->sp_pwdp != NULL)
free (pwd->sp_pwdp);
memset (pwd, '\0', sizeof (struct spwd));

View File

@ -204,7 +204,6 @@ do_section(const res_state statp,
rrnum++;
}
cleanup:
if (buf != NULL)
free(buf);
}

View File

@ -86,7 +86,6 @@ x_inline (XDR *xdrs, u_int len)
else
{
/* Free the earlier space and allocate new area */
if (xdrs->x_private)
free (xdrs->x_private);
if ((xdrs->x_private = (caddr_t) malloc (len)) == NULL)
{
@ -157,7 +156,6 @@ xdr_sizeof (xdrproc_t func, void *data)
x.x_base = (caddr_t) 0;
stat = func (&x, data);
if (x.x_private)
free (x.x_private);
return stat == TRUE ? x.x_handy : 0;
}

View File

@ -59,7 +59,6 @@ if_freenameindex (struct if_nameindex *ifn)
struct if_nameindex *ptr = ifn;
while (ptr->if_name || ptr->if_index)
{
if (ptr->if_name)
free (ptr->if_name);
++ptr;
}

View File

@ -322,7 +322,6 @@ __sprofil (struct prof *profp, int profcnt, struct timeval *tvp,
for (i = 0; i < profcnt; ++i)
if (add_region (p[i], (flags & PROF_UINT) != 0) < 0)
{
if (prof_info.region)
free (prof_info.region);
prof_info.num_regions = 0;
prof_info.region = NULL;

View File

@ -29,11 +29,8 @@ _nl_cleanup_time (struct locale_data *locale)
locale->private.time = NULL;
locale->private.cleanup = NULL;
if (data->eras != NULL)
free (data->eras);
if (data->alt_digits != NULL)
free (data->alt_digits);
if (data->walt_digits != NULL)
free (data->walt_digits);
free (data);

View File

@ -414,7 +414,6 @@ tzset_internal (always, explicit)
tz_rules[1].name = NULL;
/* Save the value of `tz'. */
if (old_tz != NULL)
free (old_tz);
old_tz = tz ? __strdup (tz) : NULL;