Skip to content

Commit 3d2f735

Browse files
committed
Fix CID 1393665 (Uninitialized scalar variable)
Signed-off-by: Stefan Weil <[email protected]>
1 parent a95917a commit 3d2f735

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/opencl/openclwrapper.cpp

+16-20
Original file line numberDiff line numberDiff line change
@@ -2302,29 +2302,26 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
23022302
ds_device_type type) {
23032303
double time;
23042304
#if ON_WINDOWS
2305-
LARGE_INTEGER freq, time_funct_start, time_funct_end;
2306-
QueryPerformanceFrequency(&freq);
2305+
LARGE_INTEGER freq, time_funct_start, time_funct_end;
2306+
QueryPerformanceFrequency(&freq);
23072307
#elif ON_APPLE
2308-
mach_timebase_info_data_t info = {0, 0};
2309-
mach_timebase_info(&info);
2310-
long long start, stop;
2308+
mach_timebase_info_data_t info = {0, 0};
2309+
mach_timebase_info(&info);
2310+
long long start, stop;
23112311
#else
2312-
timespec time_funct_start, time_funct_end;
2312+
timespec time_funct_start, time_funct_end;
23132313
#endif
23142314

23152315
// input data
23162316
unsigned char pixelHi = (unsigned char)255;
2317-
int* thresholds = new int[4];
2318-
thresholds[0] = pixelHi/2;
2319-
thresholds[1] = pixelHi/2;
2320-
thresholds[2] = pixelHi/2;
2321-
thresholds[3] = pixelHi/2;
2322-
int *hi_values = new int[4];
2323-
thresholds[0] = pixelHi;
2324-
thresholds[1] = pixelHi;
2325-
thresholds[2] = pixelHi;
2326-
thresholds[3] = pixelHi;
2327-
//Pix* pix = pixCreate(width, height, 1);
2317+
int thresholds[4] = {
2318+
pixelHi,
2319+
pixelHi,
2320+
pixelHi,
2321+
pixelHi
2322+
};
2323+
2324+
//Pix* pix = pixCreate(width, height, 1);
23282325
int top = 0;
23292326
int left = 0;
23302327
int bytes_per_line = input.width*input.numChannels;
@@ -2340,6 +2337,7 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
23402337
#endif
23412338

23422339
OpenclDevice::gpuEnv = *env;
2340+
int hi_values[4];
23432341
int retVal = OpenclDevice::ThresholdRectToPixOCL(
23442342
input.imageData, input.numChannels, bytes_per_line, thresholds,
23452343
hi_values, &input.pix, input.height, input.width, top, left);
@@ -2372,6 +2370,7 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
23722370
#else
23732371
clock_gettime( CLOCK_MONOTONIC, &time_funct_start );
23742372
#endif
2373+
int hi_values[4] = {};
23752374
ThresholdRectToPix_Native( input.imageData, input.numChannels, bytes_per_line,
23762375
thresholds, hi_values, &input.pix );
23772376

@@ -2387,9 +2386,6 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
23872386
#endif
23882387
}
23892388

2390-
// cleanup
2391-
delete[] thresholds;
2392-
delete[] hi_values;
23932389
return time;
23942390
}
23952391

0 commit comments

Comments
 (0)