do not leak memory
This commit is contained in:
parent
717548874c
commit
d971198fd3
1 changed files with 24 additions and 3 deletions
|
@ -29,6 +29,8 @@
|
||||||
// MARKER(update_precomp.py): autogen include statement, do not remove
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
||||||
#include "precompiled_hwpfilter.hxx"
|
#include "precompiled_hwpfilter.hxx"
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "hwpreader.hxx"
|
#include "hwpreader.hxx"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
//#ifndef UDK100
|
//#ifndef UDK100
|
||||||
|
@ -84,6 +86,20 @@ static hchar sbuf[256];
|
||||||
static hchar *field = 0L;
|
static hchar *field = 0L;
|
||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct Free
|
||||||
|
{
|
||||||
|
void operator()(T* const ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
struct HwpReaderPrivate
|
struct HwpReaderPrivate
|
||||||
{
|
{
|
||||||
HwpReaderPrivate()
|
HwpReaderPrivate()
|
||||||
|
@ -1781,7 +1797,8 @@ void HwpReader::makePageStyle()
|
||||||
if( hwpinfo->back_info.type == 2 ){
|
if( hwpinfo->back_info.type == 2 ){
|
||||||
rstartEl(ascii("office:binary-data"), rList);
|
rstartEl(ascii("office:binary-data"), rList);
|
||||||
pList->clear();
|
pList->clear();
|
||||||
rchars(ascii(base64_encode_string((unsigned char *) hwpinfo->back_info.data, hwpinfo->back_info.size )));
|
boost::shared_ptr<char> pStr(base64_encode_string((unsigned char *) hwpinfo->back_info.data, hwpinfo->back_info.size ), Free<char>());
|
||||||
|
rchars(ascii(pStr.get()));
|
||||||
rendEl(ascii("office:binary-data"));
|
rendEl(ascii("office:binary-data"));
|
||||||
}
|
}
|
||||||
rendEl(ascii("style:background-image"));
|
rendEl(ascii("style:background-image"));
|
||||||
|
@ -3993,7 +4010,10 @@ void HwpReader::makePicture(Picture * hbox)
|
||||||
if( hbox->pictype == PICTYPE_EMBED ){
|
if( hbox->pictype == PICTYPE_EMBED ){
|
||||||
EmPicture *emp = hwpfile.GetEmPicture(hbox);
|
EmPicture *emp = hwpfile.GetEmPicture(hbox);
|
||||||
if( emp )
|
if( emp )
|
||||||
rchars(ascii(base64_encode_string( emp->data, emp->size )));
|
{
|
||||||
|
boost::shared_ptr<char> pStr(base64_encode_string( emp->data, emp->size ), Free<char>());
|
||||||
|
rchars(ascii(pStr.get()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if( hwpfile.oledata ){
|
if( hwpfile.oledata ){
|
||||||
|
@ -4015,7 +4035,8 @@ void HwpReader::makePicture(Picture * hbox)
|
||||||
rchars(ascii(""));
|
rchars(ascii(""));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
rchars(ascii(base64_encode_string( (uchar *)pObj, strlen((char *)pObj) )));
|
boost::shared_ptr<char> pStr(base64_encode_string( (uchar *)pObj, strlen((char *)pObj)), Free<char>());
|
||||||
|
rchars(ascii(pStr.get()));
|
||||||
pObj->Release();
|
pObj->Release();
|
||||||
srcsto->Release();
|
srcsto->Release();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue