fix memory leaks introduced since introduction of my_expand()
This commit is contained in:
parent
fddc4650d1
commit
882f7f7434
|
|
@ -21,7 +21,7 @@ BEGIN{
|
|||
while(getline < filename) {
|
||||
if(create_id == 0) {
|
||||
if(!start) f = f "\n"
|
||||
str = gensub(/(my_(malloc|calloc|realloc|free|strcat|strncat|mstrcat|strdup|strdup2))\([0-9]+,/, "\\1(_ALLOC_ID_,", "G")
|
||||
str = gensub(/(my_(malloc|calloc|realloc|free|strcat|strcat2|strncat|mstrcat|strdup|strdup2))\([0-9]+,/, "\\1(_ALLOC_ID_,", "G")
|
||||
if(str != $0) changed = 1
|
||||
f = f str
|
||||
} else {
|
||||
|
|
|
|||
11
src/draw.c
11
src/draw.c
|
|
@ -277,6 +277,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
|
|||
&textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,
|
||||
xctx->areay2,textx1,texty1,textx2,texty2)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +364,10 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
|
|||
text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1,
|
||||
&textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,
|
||||
textx1,texty1,textx2,texty2)) return;
|
||||
textx1,texty1,textx2,texty2)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
x1=textx1;y1=texty1;
|
||||
if(rot&1) {y1=texty2;rot=3;}
|
||||
else rot=0;
|
||||
|
|
@ -415,7 +419,10 @@ void draw_temp_string(GC gctext, int what, const char *str, short rot, short fli
|
|||
estr = my_expand(str, tclgetintvar("tabstop"));
|
||||
dbg(2, "draw_string(): string=%s\n",estr);
|
||||
if(!text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1,
|
||||
&textx1,&texty1,&textx2,&texty2, &tmp, &dtmp)) return;
|
||||
&textx1,&texty1,&textx2,&texty2, &tmp, &dtmp)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
drawtemprect(gctext,what, textx1,texty1,textx2,texty2);
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -686,6 +686,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in
|
|||
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,
|
||||
xctx->areay2,textx1,texty1,textx2,texty2)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
if(hcenter) {
|
||||
|
|
@ -755,7 +756,10 @@ static void old_ps_draw_string(int gctext, const char *str,
|
|||
x1,y1, &rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line);
|
||||
#endif
|
||||
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) return;
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
set_ps_colors(gctext);
|
||||
x1=rx1;y1=ry1;
|
||||
if(rot&1) {y1=ry2;rot=3;}
|
||||
|
|
|
|||
|
|
@ -334,6 +334,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i
|
|||
text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x,y,
|
||||
&textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
if(hcenter) {
|
||||
|
|
@ -403,7 +404,10 @@ static void old_svg_draw_string(int layer, const char *str,
|
|||
text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x,y,
|
||||
&rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line);
|
||||
#endif
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) return;
|
||||
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) {
|
||||
my_free(_ALLOC_ID_, &estr);
|
||||
return;
|
||||
}
|
||||
x=rx1;y=ry1;
|
||||
if(rot&1) {y=ry2;rot=3;}
|
||||
else rot=0;
|
||||
|
|
|
|||
|
|
@ -943,6 +943,7 @@ static void xwin_exit(void)
|
|||
list_tokens(NULL, 0); /* clear static data in function */
|
||||
translate(0, NULL); /* clear static data in function */
|
||||
translate2(NULL, 0, NULL); /* clear static data in function */
|
||||
translate3(NULL, 0, NULL, NULL, NULL); /* clear static data in function */
|
||||
subst_token(NULL, NULL, NULL); /* clear static data in function */
|
||||
find_nth(NULL, "", "", 0, 0); /* clear static data in function */
|
||||
trim_chars(NULL, ""); /* clear static data in function */
|
||||
|
|
@ -959,13 +960,13 @@ static void xwin_exit(void)
|
|||
my_free(_ALLOC_ID_, &cli_opt_argv[i]);
|
||||
}
|
||||
my_free(_ALLOC_ID_, &cli_opt_argv);
|
||||
if(xschem_web_dirname[0]) tclvareval("file delete -force ", xschem_web_dirname, NULL);
|
||||
if(errfp!=stderr) fclose(errfp);
|
||||
errfp=stderr;
|
||||
dbg(1, "xwin_exit(): closing tcp servers\n");
|
||||
tcleval("if {[info exists xschem_server_getdata(server)]} { close $xschem_server_getdata(server) }");
|
||||
tcleval("if {[info exists bespice_server_getdata(server)]} { close $bespice_server_getdata(server) }");
|
||||
if(!cli_opt_detach) printf("\n");
|
||||
if(xschem_web_dirname[0]) tclvareval("file delete -force ", xschem_web_dirname, NULL);
|
||||
init_done=0; /* 20150409 to avoid multiple calls */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue