kopia lustrzana https://gitlab.com/sane-project/backends
valgrind memory leaks/overwrite fixes
rodzic
9734e8eb5a
commit
efd59b1535
|
@ -3128,15 +3128,19 @@ compute_gl843_coefficients (Genesys_Device * dev,
|
||||||
darkptr = (uint16_t *) dev->dark_average_data;
|
darkptr = (uint16_t *) dev->dark_average_data;
|
||||||
whiteptr = (uint16_t *) dev->white_average_data;
|
whiteptr = (uint16_t *) dev->white_average_data;
|
||||||
|
|
||||||
size = pixels * 2 * 3 * 256 / 252 * 2 + 512;
|
size = (pixels * 2 * 3 * 256) / 252 * 2 + 512;
|
||||||
free (buffer);
|
DBG (DBG_io, "%s: final shading size=%04x\n", __FUNCTION__, size);
|
||||||
buffer = (unsigned short *) malloc (size);
|
*shading_data = (unsigned short *) malloc (size);
|
||||||
if (buffer == NULL)
|
if (*shading_data == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
memset(*shading_data,0,size);
|
||||||
|
|
||||||
/* offset */
|
/* offset */
|
||||||
buffer = buffer + 12;
|
buffer = *shading_data;
|
||||||
count = 12;
|
count = 0;
|
||||||
|
|
||||||
|
/* loop over calibration data to build shading coefficients */
|
||||||
for (i = 0; i < pixels; i++)
|
for (i = 0; i < pixels; i++)
|
||||||
{
|
{
|
||||||
/* red */
|
/* red */
|
||||||
|
@ -3529,9 +3533,8 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
|
||||||
target_code);
|
target_code);
|
||||||
break;
|
break;
|
||||||
case CCD_KVSS080:
|
case CCD_KVSS080:
|
||||||
words_per_color=pixels_per_line * 2;
|
|
||||||
length = words_per_color * 3 * 2;
|
|
||||||
target_code = 0xe000;
|
target_code = 0xe000;
|
||||||
|
free(shading_data);
|
||||||
length=compute_gl843_coefficients (dev,
|
length=compute_gl843_coefficients (dev,
|
||||||
&shading_data,
|
&shading_data,
|
||||||
pixels_per_line,
|
pixels_per_line,
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ getLine (int height, int width, int * buff,
|
||||||
|
|
||||||
/* dont forget to cleanup */
|
/* dont forget to cleanup */
|
||||||
cleanup:
|
cleanup:
|
||||||
for(i=0;i<10;i++){
|
for(i=0;i<slopes;i++){
|
||||||
if(lines[i])
|
if(lines[i])
|
||||||
free(lines[i]);
|
free(lines[i]);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue