From bf52b3d0734393f0844fb60a94b8ba1b3b42ded5 Mon Sep 17 00:00:00 2001 From: Dhruv Khattar Date: Tue, 9 Aug 2016 23:01:53 +0530 Subject: [PATCH] Coverity #1099169, #1320913, #1321304 fixed Change-Id: I1646c9c3b52d18c459bfad5a37b800d06878306e --- scilab/modules/scicos_blocks/src/c/cscopxy3d.c | 12 +++++++++--- scilab/modules/scicos_blocks/src/cpp/fromws_c.cpp | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scilab/modules/scicos_blocks/src/c/cscopxy3d.c b/scilab/modules/scicos_blocks/src/c/cscopxy3d.c index 40451c1..70d0673 100644 --- a/scilab/modules/scicos_blocks/src/c/cscopxy3d.c +++ b/scilab/modules/scicos_blocks/src/c/cscopxy3d.c @@ -344,15 +344,21 @@ error_handler: static void appendData(scicos_block * block, double *x, double *y, double *z) { int i; + int maxNumberOfPoints; + int numberOfPoints; sco_data *sco = (sco_data *) * (block->work); - int maxNumberOfPoints = sco->internal.maxNumberOfPoints; - int numberOfPoints = sco->internal.numberOfPoints; + if (sco == NULL) + { + return; + } + maxNumberOfPoints = sco->internal.maxNumberOfPoints; + numberOfPoints = sco->internal.numberOfPoints; /* * Handle the case where the scope has more points than maxNumberOfPoints */ - if (sco != NULL && numberOfPoints >= maxNumberOfPoints) + if (numberOfPoints >= maxNumberOfPoints) { // on a full scope, re-alloc maxNumberOfPoints = maxNumberOfPoints + block->ipar[2]; diff --git a/scilab/modules/scicos_blocks/src/cpp/fromws_c.cpp b/scilab/modules/scicos_blocks/src/cpp/fromws_c.cpp index 235fb57..347e1b7 100644 --- a/scilab/modules/scicos_blocks/src/cpp/fromws_c.cpp +++ b/scilab/modules/scicos_blocks/src/cpp/fromws_c.cpp @@ -410,6 +410,7 @@ SCICOS_BLOCKS_IMPEXP void fromws_c(scicos_block* block, int flag) *work = nullptr; delete[] (char*) ptr->work; delete[] ptr; + delete[] ptDims; closeHDF5File(fd); return; } @@ -420,6 +421,7 @@ SCICOS_BLOCKS_IMPEXP void fromws_c(scicos_block* block, int flag) *work = nullptr; delete[] (char*) ptr->work; delete[] ptr; + delete[] ptDims; closeHDF5File(fd); return; } @@ -435,6 +437,7 @@ SCICOS_BLOCKS_IMPEXP void fromws_c(scicos_block* block, int flag) delete[] (char*) ptr->work; delete[] ptr; closeHDF5File(fd); + return; } /* Close the file */ -- 1.7.9.5