Crash: MODE_SGBM compute() -c++ application with OpenCV 4.3.0 on linux

Our c++ application is using opencv 4.3.0 and runs on linux. In The below code snippet, if we comment out the fprintf, its crashing. [Note: There is not core dump generated and we can’t debug also in our current environment]. We doubt in pMatcher->compute some of the memory used internally is not deallocated properly. If anyone faced similar issue or point whats wrong will be useful.

process(
    uint16_t        *RESTRICT const pDispLeft,
    uint8_t         *RESTRICT const pDispConf,
    const uint16_t  *RESTRICT const pLeft,
    const uint16_t  *RESTRICT const pRight,
    const int32_t                   dispSizeBytes
)
{

    //fprintf(stderr, "start\n");
    
    static input_sim_data l_StvData;
    memset(&l_StvData, 0, sizeof(l_StvData));


    input_sim_data &l_stvConfig = l_StvData.input.stvConfig;

    // Set version of the structure
    l_StvData.version = SIM_VERSION;

    // Fill STV simulator configuration in shared memory
    l_stvConfig = m_cfg; //filled properly
    
    // Note: The input ROI is always copied at (0,0) of the
    // STV image buffer therefore the offsets are set to 0.
    l_StvData.input.roiStartX = 0;
    l_StvData.input.roiStartY = 0;
    l_StvData.input.roiSizeX = m_ipRoi.width();
    l_StvData.input.roiSizeY = m_ipRoi.height();
    l_StvData.input.width = m_ipRoi.width();
    l_StvData.input.height = m_ipRoi.height();

    l_StvData.output.success = 0U;

	
    // Copy left and right image into shared memory
    copyRoi(l_StvData.input.leftImage, pLeft);
    copyRoi(l_StvData.input.rightImage, pRight);

    const ip_config &conf = l_StvData.input.Config;
    const int32_t numDisp = conf.sgmParams.maxDisparity - conf.sgmParams.minDisparity;
    assert((numDisp % 16) == 0);
    assert(numDisp > 0);

    const int32_t bs = conf.sgmParams.blockSize;
    const int32_t k = conf.sgmParams.k;

    const int32_t marginX = 32;
    const int32_t marginY = 28;
    
    
    auto pMatcher = cv::StereoSGBM::create(conf.sgmParams.minDisparity, numDisp, bs);
    pMatcher->setMode(cv::StereoSGBM::MODE_SGBM);
    pMatcher->setP1(bs * bs * k * 8);
    pMatcher->setP2(bs * bs * k * 32);
    pMatcher->setMinDisparity(conf.sgmParams.minDisparity);
    pMatcher->setNumDisparities(numDisp);
    pMatcher->setBlockSize(bs);
    pMatcher->setDisp12MaxDiff(-1);
    
    pMatcher->setUniquenessRatio(conf.sgmParams.uniquenessRatio);
    
    pMatcher->setSpeckleWindowSize(10);
    pMatcher->setSpeckleRange(10);
    
    cv::Mat leftFull16 (l_StvData.input.height, l_StvData.input.width, CV_16UC1, const_cast<uint16_t *>(l_StvData.input.leftImage));
    cv::Mat rightFull16 (l_StvData.input.height, l_StvData.input.width, CV_16UC1, const_cast<uint16_t *>(l_StvData.input.rightImage));
    static cv::Mat leftFull;
    static cv::Mat rightFull;
    leftFull16.convertTo(leftFull, CV_8UC1, 0.25);
    rightFull16.convertTo(rightFull, CV_8UC1, 0.25);
    cv::Mat out(l_StvData.input.height, l_StvData.input.width, CV_16SC1);

    cv::Rect roi(static_cast<int32_t>(l_StvData.input.roiStartX), static_cast<int32_t>(l_StvData.input.roiStartY), static_cast<int32_t>(l_StvData.input.roiSizeX), static_cast<int32_t>(l_StvData.input.roiSizeY));

     
    pMatcher->compute(leftFull(roi), rightFull(roi), out(roi));
    
    
	/* Operate on the output */
    return OK;
}