reordering of some function calls to prevent memory leaks
This commit is contained in:
parent
3958faf1aa
commit
6fcdd46022
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
/* Caller should free returned buffer */
|
||||
char *base64_encode(const unsigned char *data, size_t input_length, size_t *output_length) {
|
||||
static char b64_enc[] = {
|
||||
static const char b64_enc[] = {
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
|
|
@ -61,7 +61,7 @@ char *base64_encode(const unsigned char *data, size_t input_length, size_t *outp
|
|||
|
||||
/* Caller should free returned buffer */
|
||||
unsigned char *base64_decode(const char *data, size_t input_length, size_t *output_length) {
|
||||
static unsigned char b64_dec[256] = {
|
||||
static const unsigned char b64_dec[256] = {
|
||||
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
|
||||
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
|
||||
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3e, 0x3f, 0x3f, 0x3f, 0x3f,
|
||||
|
|
|
|||
10
src/xinit.c
10
src/xinit.c
|
|
@ -630,13 +630,13 @@ void delete_schematic_data(void)
|
|||
delete_netlist_structs();
|
||||
clear_all_hilights(); /* data structs for hilighting nets/instances */
|
||||
get_unnamed_node(0, 0, 0); /* net### enumerator used for netlisting */
|
||||
clear_drawing();
|
||||
if(has_x) {
|
||||
resetwin(0, 1, 1, 0, 0); /* delete preview pixmap, delete cairo surfaces */
|
||||
free_gc();
|
||||
}
|
||||
/* delete instances, wires, lines, rects, arcs, polys, texts, hash_inst, hash_wire,
|
||||
* inst & wire .node fields, instance name hash */
|
||||
clear_drawing();
|
||||
remove_symbols();
|
||||
free_rawfile(0);
|
||||
free_xschem_data(); /* delete the xctx struct */
|
||||
|
|
@ -1475,10 +1475,6 @@ void change_linewidth(double w)
|
|||
void resetcairo(int create, int clear, int force_or_resize)
|
||||
{
|
||||
#if HAS_CAIRO==1
|
||||
cairo_font_options_t *options;
|
||||
options = cairo_font_options_create();
|
||||
cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_FAST);
|
||||
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_SLIGHT);
|
||||
dbg(1, "resetcairo() %d, %d, %d\n", create, clear, force_or_resize);
|
||||
if(clear && force_or_resize) {
|
||||
/* xctx->cairo_save_sfc is based on pixmap and pixmaps are not resizeable, so on resize
|
||||
|
|
@ -1490,6 +1486,10 @@ void resetcairo(int create, int clear, int force_or_resize)
|
|||
cairo_surface_destroy(xctx->cairo_sfc);
|
||||
}
|
||||
if(create && force_or_resize) {
|
||||
cairo_font_options_t *options;
|
||||
options = cairo_font_options_create();
|
||||
cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_FAST);
|
||||
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_SLIGHT);
|
||||
/***** Create Cairo save buffer drawing area *****/
|
||||
xctx->cairo_save_sfc =
|
||||
cairo_xlib_surface_create(display, xctx->save_pixmap, visual, xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
|
|
|
|||
Loading…
Reference in New Issue