summaryrefslogtreecommitdiff
path: root/btt/plat.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2011-12-16 13:15:54 -0600
committerJens Axboe <jaxboe@fusionio.com>2012-02-01 13:14:28 +0100
commit84b321fac4e417b1a1d91df1c5844a3c13ef53e5 (patch)
treea940a187ed7339148c4dc39ae79731f93ff4e8f7 /btt/plat.c
parent6ca1e530ba80c37dc9a686259fe643548ffce69c (diff)
downloadblktrace-84b321fac4e417b1a1d91df1c5844a3c13ef53e5.tar.gz
blktrace-84b321fac4e417b1a1d91df1c5844a3c13ef53e5.tar.bz2
Fix several leaks on error paths
In several cases space is allocated for a filename but not freed if open of that file fails. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'btt/plat.c')
-rw-r--r--btt/plat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/btt/plat.c b/btt/plat.c
index e7b7dde..dff7115 100644
--- a/btt/plat.c
+++ b/btt/plat.c
@@ -42,6 +42,8 @@ void *plat_alloc(struct d_info *dip, char *post)
sprintf(oname, "%s%s_plat.dat", dip->dip_name, post);
if ((pp->fp = my_fopen(oname, "w")) == NULL) {
perror(oname);
+ free(oname);
+ free(pp);
return NULL;
}
add_file(pp->fp, oname);