fix a small memory leak issue in waves_callback(), variable curr_sim_type, fix random clipping (due to uninitialized var instead of rect coordinates) in ps_filledrect()
This commit is contained in:
parent
c91aff2abd
commit
21dbd0e340
|
|
@ -907,9 +907,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
int same_sim_type = 0;
|
int same_sim_type = 0;
|
||||||
char *curr_sim_type = NULL;
|
char *curr_sim_type = NULL;
|
||||||
r = &xctx->rect[GRIDLAYER][i];
|
r = &xctx->rect[GRIDLAYER][i];
|
||||||
my_strdup2(_ALLOC_ID_, &curr_sim_type, get_tok_value(r->prop_ptr, "sim_type", 0));
|
|
||||||
need_redraw = 0;
|
need_redraw = 0;
|
||||||
if( !(r->flags & 1) ) continue; /* 1: graph; 3: graph_unlocked */
|
if( !(r->flags & 1) ) continue; /* 1: graph; 3: graph_unlocked */
|
||||||
|
my_strdup2(_ALLOC_ID_, &curr_sim_type, get_tok_value(r->prop_ptr, "sim_type", 0));
|
||||||
gr->gx1 = gr->master_gx1;
|
gr->gx1 = gr->master_gx1;
|
||||||
gr->gx2 = gr->master_gx2;
|
gr->gx2 = gr->master_gx2;
|
||||||
gr->gw = gr->master_gw;
|
gr->gw = gr->master_gw;
|
||||||
|
|
|
||||||
|
|
@ -572,7 +572,7 @@ static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,doub
|
||||||
y1=Y_TO_PS(recty1);
|
y1=Y_TO_PS(recty1);
|
||||||
x2=X_TO_PS(rectx2);
|
x2=X_TO_PS(rectx2);
|
||||||
y2=Y_TO_PS(recty2);
|
y2=Y_TO_PS(recty2);
|
||||||
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&tmp,&tmp,&tmp,&tmp) )
|
if(rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2))
|
||||||
{
|
{
|
||||||
psdash = dash / xctx->zoom;
|
psdash = dash / xctx->zoom;
|
||||||
if(dash) {
|
if(dash) {
|
||||||
|
|
@ -1233,7 +1233,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
|
||||||
fprintf(errfp, "ps_draw(): can not create tmpfile %s\n", *psfile);
|
fprintf(errfp, "ps_draw(): can not create tmpfile %s\n", *psfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setbuf(fd, NULL); /*To prevent buffer errors, still investigating cause. */
|
/* setbuf(fd, NULL); */ /* To prevent buffer errors, still investigating cause. */
|
||||||
}
|
}
|
||||||
ps_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Ps_color));
|
ps_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Ps_color));
|
||||||
if(ps_colors==NULL){
|
if(ps_colors==NULL){
|
||||||
|
|
|
||||||
|
|
@ -3909,7 +3909,8 @@ const char *translate(int inst, const char* s)
|
||||||
#ifdef __unix__
|
#ifdef __unix__
|
||||||
if(get_sp_cur) {
|
if(get_sp_cur) {
|
||||||
regfree(get_sp_cur);
|
regfree(get_sp_cur);
|
||||||
get_sp_cur = NULL;
|
/* get_sp_cur = NULL; */
|
||||||
|
my_free(_ALLOC_ID_, &get_sp_cur);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue