Fixing a small resource leak.

With Best Regards, Tim

From d52c2951f4d805042a9dcb4cc9de0a4cabe1999d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <[email protected]>
Date: Wed, 17 May 2017 09:22:46 +0200
Subject: [PATCH] parse-datetime: Fix memleak

* lib/parse-datetime.y (parse_datetime2): Cleanup on
  localtime_rz() failure.
---
 ChangeLog            | 7 +++++++
 lib/parse-datetime.y | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 81f73449e..30ee9a16d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2017-05-16  Tim Rühsen  <[email protected]>
 
+	parse-datetime: Fix memleak
+
+	* lib/parse-datetime.y (parse_datetime2): Cleanup on
+	localtime_rz() failure.
+
+2017-05-16  Tim Rühsen  <[email protected]>
+
 	README: Add notes for first-time contributors
 	* README: Add text written by Bruno Haible
 
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 598e385cb..60c64934c 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1811,7 +1811,7 @@ parse_datetime2 (struct timespec *result, char const *p,
 
   struct tm tmp;
   if (! localtime_rz (tz, &now->tv_sec, &tmp))
-    return false;
+    goto fail;
 
   /* As documented, be careful to treat the empty string just like
      a date string of "0".  Without this, an empty string would be
-- 
2.11.0

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to