From: Abdelrazak Younes Date: Wed, 8 Oct 2008 15:12:49 +0000 (+0000) Subject: fix memory leak. X-Git-Tag: 1.6.10~3111 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=47020302aebfa64bff4b1e3a27ab4fe9e848e326;p=lyx.git fix memory leak. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26815 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/paragraph_funcs.cpp b/src/paragraph_funcs.cpp index f771391560..d8a7a858fb 100644 --- a/src/paragraph_funcs.cpp +++ b/src/paragraph_funcs.cpp @@ -42,7 +42,11 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos, if (Inset * tmpInset = fromPar.getInset(fromPos)) { fromPar.releaseInset(fromPos); // The inset is not in fromPar any more. - return toPar.insertInset(toPos, tmpInset, tmpFont, tmpChange); + if (!toPar.insertInset(toPos, tmpInset, tmpFont, tmpChange)) { + delete tmpInset; + return false; + } + return true; } char_type const tmpChar = fromPar.getChar(fromPos);