From 82a7c62cada400c56fb12010777c807866a474d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Tue, 15 Aug 2017 12:39:04 +0200
Subject: [PATCH] Compiler [cpp]: Fixed memory leak.

---
 src/preprocessor.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/preprocessor.h b/src/preprocessor.h
index 063b4bb1bd..0e210f72e3 100644
--- a/src/preprocessor.h
+++ b/src/preprocessor.h
@@ -419,8 +419,6 @@ static ptrdiff_t low_cpp(struct cpp *this,
 	      {
 		if((d=FIND_DEFINE(s)))
 		  d->inside = inside;
-
-		free_string(s);
 	      }
 
 	      free_string_builder(&tmp);
@@ -428,8 +426,10 @@ static ptrdiff_t low_cpp(struct cpp *this,
           }else{
             if (OUTP())
               string_builder_shared_strcat (&this->buf, s);
-            free_string (s);
           }
+	  if (s) {
+	    free_string(s);
+	  }
         }
         break;
 
-- 
GitLab