use MemoryDeleter to make sure we free 'flattenedRuns' on error, in every case. CID 905
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27514 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,6 +8,8 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
|
|||||||
|
|
||||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
|
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
|
||||||
|
|
||||||
|
UsePrivateHeaders shared ;
|
||||||
|
|
||||||
Translator RTF-Translator :
|
Translator RTF-Translator :
|
||||||
# RTFTranslator classes
|
# RTFTranslator classes
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include <Node.h>
|
#include <Node.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -573,6 +575,8 @@ convert_to_stxt(RTF::Header &header, BDataIO &target)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BPrivate::MemoryDeleter _(flattenedRuns);
|
||||||
|
|
||||||
// put out styles
|
// put out styles
|
||||||
|
|
||||||
TranslatorStyledTextStyleHeader styleHeader;
|
TranslatorStyledTextStyleHeader styleHeader;
|
||||||
@@ -596,8 +600,6 @@ convert_to_stxt(RTF::Header &header, BDataIO &target)
|
|||||||
// output actual style information
|
// output actual style information
|
||||||
written = target.Write(flattenedRuns, flattenedSize);
|
written = target.Write(flattenedRuns, flattenedSize);
|
||||||
|
|
||||||
free(flattenedRuns);
|
|
||||||
|
|
||||||
if (written < B_OK)
|
if (written < B_OK)
|
||||||
return written;
|
return written;
|
||||||
if (written != flattenedSize)
|
if (written != flattenedSize)
|
||||||
|
|||||||
Reference in New Issue
Block a user