monoscope: stack needs to be size+1 as we put a end-marker into it
Valgrind is still complaining about one bad read, but this takes care of the crash mentioned in the comment and in bug #564122.
This commit is contained in:
parent
4e9daf0e49
commit
d2ee8b979d
@ -90,7 +90,7 @@ struct _struct_convolve_state
|
|||||||
double left[CONVOLVE_BIG];
|
double left[CONVOLVE_BIG];
|
||||||
double right[CONVOLVE_SMALL * 3];
|
double right[CONVOLVE_SMALL * 3];
|
||||||
double scratch[CONVOLVE_SMALL * 3];
|
double scratch[CONVOLVE_SMALL * 3];
|
||||||
stack_entry stack[STACK_SIZE];
|
stack_entry stack[STACK_SIZE + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -102,7 +102,7 @@ struct _struct_convolve_state
|
|||||||
convolve_state *
|
convolve_state *
|
||||||
convolve_init (void)
|
convolve_init (void)
|
||||||
{
|
{
|
||||||
return (convolve_state *) malloc (sizeof (convolve_state));
|
return (convolve_state *) calloc (1, sizeof (convolve_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -111,8 +111,7 @@ convolve_init (void)
|
|||||||
void
|
void
|
||||||
convolve_close (convolve_state * state)
|
convolve_close (convolve_state * state)
|
||||||
{
|
{
|
||||||
if (state)
|
free (state);
|
||||||
free (state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -267,7 +266,7 @@ convolve_match (const int *lastchoice,
|
|||||||
double *left = state->left;
|
double *left = state->left;
|
||||||
double *right = state->right;
|
double *right = state->right;
|
||||||
double *scratch = state->scratch;
|
double *scratch = state->scratch;
|
||||||
stack_entry *top = state->stack + STACK_SIZE - 1;
|
stack_entry *top = state->stack + (STACK_SIZE - 1);
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
for (i = 0; i < 512; i++)
|
for (i = 0; i < 512; i++)
|
||||||
@ -288,9 +287,7 @@ convolve_match (const int *lastchoice,
|
|||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
right[i] -= avg;
|
right[i] -= avg;
|
||||||
/* End-of-stack marker. */
|
/* End-of-stack marker. */
|
||||||
#if 0 /* The following line produces a CRASH, need to figure out why?!! */
|
|
||||||
top[1].b.null = scratch;
|
top[1].b.null = scratch;
|
||||||
#endif
|
|
||||||
top[1].b.main = NULL;
|
top[1].b.main = NULL;
|
||||||
/* The low 256x256, of which we want the high 256 outputs. */
|
/* The low 256x256, of which we want the high 256 outputs. */
|
||||||
top->v.left = left;
|
top->v.left = left;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user