fix if(p)/free(p) construct

No need of explicit NULL check before free.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Maninder Singh 2015-06-01 10:38:07 +00:00 committed by Denys Vlasenko
parent d90899206d
commit 0fabedf085
4 changed files with 7 additions and 14 deletions

View File

@ -44,7 +44,6 @@ void blkid_free_dev(blkid_dev dev)
bit_tags);
blkid_free_tag(tag);
}
if (dev->bid_name)
free(dev->bid_name);
free(dev);
}

View File

@ -354,11 +354,8 @@ static void parse_escape(char *word)
static void free_instance(struct fsck_instance *i)
{
if (i->prog)
free(i->prog);
if (i->device)
free(i->device);
if (i->base_device)
free(i->base_device);
free(i);
}
@ -432,7 +429,6 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs)
fs = create_fs_device(device, mntpnt, type ? type : "auto", opts,
freq ? atoi(freq) : -1,
passno ? atoi(passno) : -1);
if (dev)
free(dev);
if (!fs)

View File

@ -124,7 +124,6 @@ int conf_read_simple(const char *name)
case S_INT:
case S_HEX:
case S_STRING:
if (sym->user.val)
free(sym->user.val);
default:
sym->user.val = NULL;

View File

@ -79,7 +79,6 @@ struct gstr str_assign(const char *s)
/* Free storage for growable string */
void str_free(struct gstr *gs)
{
if (gs->s)
free(gs->s);
gs->s = NULL;
gs->len = 0;