There is no longer (since SunOS 4) any need to guard against
free (NULL), so replace each "if (p) free (p);" with "free (p);".
From Jim Meyering in
<http://lists.gnu.org/archive/html/bug-tar/2011-01/msg00026.html>.
* src/incremen.c (scan_directory, read_directory_file): As above.
(try_purge_directory): Likewise.
* src/list.c (read_header): Likewise.
* src/misc.c (assign_string): Likewise.
- if (dirp)
- free (dirp);
if (ferror (listed_incremental_stream))
read_error (listed_incremental_option);
if (ferror (listed_incremental_stream))
read_error (listed_incremental_option);
}
/* Output incremental data for the directory ENTRY to the file DATA.
}
/* Output incremental data for the directory ENTRY to the file DATA.
{
const char *entry;
struct stat st;
{
const char *entry;
struct stat st;
p = new_name (directory_name, cur);
if (deref_stat (p, &st) != 0)
p = new_name (directory_name, cur);
if (deref_stat (p, &st) != 0)
if (header->header.typeflag == GNUTYPE_LONGNAME)
{
if (header->header.typeflag == GNUTYPE_LONGNAME)
{
- if (next_long_name)
- free (next_long_name);
next_long_name = header_copy;
next_long_name_blocks = size / BLOCKSIZE;
}
else
{
next_long_name = header_copy;
next_long_name_blocks = size / BLOCKSIZE;
}
else
{
- if (next_long_link)
- free (next_long_link);
next_long_link = header_copy;
next_long_link_blocks = size / BLOCKSIZE;
}
next_long_link = header_copy;
next_long_link_blocks = size / BLOCKSIZE;
}
struct posix_header const *h = &header->header;
char namebuf[sizeof h->prefix + 1 + NAME_FIELD_SIZE + 1];
struct posix_header const *h = &header->header;
char namebuf[sizeof h->prefix + 1 + NAME_FIELD_SIZE + 1];
- if (recent_long_name)
- free (recent_long_name);
+ free (recent_long_name);
assign_string (&info->file_name, name);
info->had_trailing_slash = strip_trailing_slashes (info->file_name);
assign_string (&info->file_name, name);
info->had_trailing_slash = strip_trailing_slashes (info->file_name);
- if (recent_long_link)
- free (recent_long_link);
+ free (recent_long_link);
void
assign_string (char **string, const char *value)
{
void
assign_string (char **string, const char *value)
{
- if (*string)
- free (*string);
*string = value ? xstrdup (value) : 0;
}
*string = value ? xstrdup (value) : 0;
}