From ef9b4d6291ef10da345093deb3691fbdd2d61ce1 Mon Sep 17 00:00:00 2001
From: Tomas Pecka <peckato1@fit.cvut.cz>
Date: Fri, 12 Feb 2016 12:13:11 +0100
Subject: [PATCH] RegExp: Avoid possible segfault

---
 alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
index bf8ace2e58..32ca5ee090 100644
--- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.cpp
@@ -93,7 +93,7 @@ void FormalRegExpConcatenation::setRightElement(const FormalRegExpElement& eleme
 	FormalRegExpElement* elem = element.clone();
 	if(this->parentRegExp && !elem->attachRegExp(this->parentRegExp))
 		throw exception::AlibException("Input symbols not in the alphabet.");
-	delete left;
+	delete right;
 	this->right = elem;
 }
 
@@ -101,7 +101,7 @@ void FormalRegExpConcatenation::setRightElement(FormalRegExpElement&& element) {
 	FormalRegExpElement* elem = std::move(element).plunder();
 	if(this->parentRegExp && !elem->attachRegExp(this->parentRegExp))
 		throw exception::AlibException("Input symbols not in the alphabet.");
-	delete left;
+	delete right;
 	this->right = elem;
 }
 
-- 
GitLab