diff options
Diffstat (limited to 'hwpfilter')
-rw-r--r-- | hwpfilter/source/cspline.cpp | 1 | ||||
-rw-r--r-- | hwpfilter/source/himgutil.cpp | 3 | ||||
-rw-r--r-- | hwpfilter/source/hwpfile.cpp | 5 | ||||
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 10 | ||||
-rw-r--r-- | hwpfilter/source/lexer.cpp | 2 |
5 files changed, 19 insertions, 2 deletions
diff --git a/hwpfilter/source/cspline.cpp b/hwpfilter/source/cspline.cpp index dc2399c368a7..ba1f5330bfb3 100644 --- a/hwpfilter/source/cspline.cpp +++ b/hwpfilter/source/cspline.cpp @@ -171,5 +171,6 @@ void PeriodicSpline (int N, double* x, double* a, double*& b, double*& c, d[i] = oneThird*(c[i+1]-c[i])/h[i]; } + delete[] h; sys.DeleteMatrix(N+1,mat); } diff --git a/hwpfilter/source/himgutil.cpp b/hwpfilter/source/himgutil.cpp index 66916646c780..cdb0c3b99bd9 100644 --- a/hwpfilter/source/himgutil.cpp +++ b/hwpfilter/source/himgutil.cpp @@ -106,7 +106,8 @@ const char *GetEmbImgname(const EmPicture * empic) char *ptr; const char *ext; - tmpnam(fname); + if (tmpnam(fname) == NULL) + return NULL; if (!empic || !empic->name[0] || (0 == (ptr = strrchr(fname, DIRSEP)))) return NULL; switch (ImageMagicType((uchar *) empic->data)) diff --git a/hwpfilter/source/hwpfile.cpp b/hwpfilter/source/hwpfile.cpp index ee820ef6f445..84c093a8c825 100644 --- a/hwpfilter/source/hwpfile.cpp +++ b/hwpfilter/source/hwpfile.cpp @@ -72,6 +72,9 @@ HWPFile::HWPFile(void) */ HWPFile::~HWPFile(void) { + if (oledata) + delete oledata; + if (hiodev) delete hiodev; @@ -345,6 +348,8 @@ bool HWPFile::TagsRead(void) } break; case FILETAG_OLE_OBJECT: + if (oledata) + delete oledata; oledata = new OlePicture(size); oledata->Read(*this); break; diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index fc253ed4ce13..f971bedc498a 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -4476,10 +4476,20 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox) if( bIsNatural == sal_False ){ PeriodicSpline(n, tarr, xarr, xb, carr, darr); + // prevent memory leak + delete[] carr; + carr = 0; + delete[] darr; + darr = 0; PeriodicSpline(n, tarr, yarr, yb, carr, darr); } else{ NaturalSpline(n, tarr, xarr, xb, carr, darr); + // prevent memory leak + delete[] carr; + carr = 0; + delete[] darr; + darr = 0; NaturalSpline(n, tarr, yarr, yb, carr, darr); } diff --git a/hwpfilter/source/lexer.cpp b/hwpfilter/source/lexer.cpp index fd17509bbb7e..4ef976fcd5f8 100644 --- a/hwpfilter/source/lexer.cpp +++ b/hwpfilter/source/lexer.cpp @@ -1126,7 +1126,7 @@ YY_MALLOC_DECL /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |