diff options
author | Karel Zak <kzak@redhat.com> | 2016-10-04 16:03:11 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2016-10-04 16:03:11 +0200 |
commit | 6387bf33dbfd36fd20eeaa29479ba3e2dc9a3edf (patch) | |
tree | 1b403000de139ae543869cbcf14ea5fa97997bb2 | |
parent | 4c906abea2acd9d1ac0199e49384d13b2a1433c6 (diff) | |
download | util-linux-6387bf33dbfd36fd20eeaa29479ba3e2dc9a3edf.tar.gz |
sfdisk: free before going out of scope [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | disk-utils/sfdisk.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 1f14f2c120..d8d1a87622 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -295,10 +295,12 @@ static void backup_sectors(struct sfdisk *sf, if (read_all(devfd, (char *) buf, size) != (ssize_t) size) { fdisk_warn(sf->cxt, _("cannot read %s"), devname); + free(buf); goto fail; } if (write_all(fd, buf, size) != 0) { fdisk_warn(sf->cxt, _("cannot write %s"), fname); + free(buf); goto fail; } free(buf); |