From 3073f90b17b1d2899b036e2c45ba5324f8c34298 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 27 Feb 2014 17:04:38 -0800 Subject: [PATCH] Fix a leak on error in tzload. Change-Id: Ib5d9aaa7a618e478ce8e5e82f967cf535bb1a5a3 --- libc/tzcode/localtime.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c index e2599b439..202f031af 100644 --- a/libc/tzcode/localtime.c +++ b/libc/tzcode/localtime.c @@ -371,9 +371,8 @@ tzload(register const char* name, register struct state* const sp, goto oops; int toread; fid = __bionic_open_tzdata(name, &toread); - if (fid < 0) { - return -1; - } + if (fid < 0) + goto oops; nread = read(fid, up->buf, toread); if (close(fid) < 0 || nread <= 0) goto oops; -- 2.11.0