diff --git a/src/preprocessor.h b/src/preprocessor.h
index 063b4bb1bd85a8e5eb70957941062573b454e76f..0e210f72e3e084ce211aac5cc777a868fb3307a8 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;