Branch: Tag:

2008-05-17

2008-05-17 13:36:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fixed leak of (usually) the string "-".

Rev: src/encode.c:1.267

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: encode.c,v 1.266 2008/05/16 18:20:07 grubba Exp $ + || $Id: encode.c,v 1.267 2008/05/17 13:36:56 grubba Exp $   */      #include "global.h"
2465:    end_first_pass(0);   }    + static void restore_current_file(void *save_current_file) + { +  struct compilation *c = THIS_COMPILATION; +  free_string(c->lex.current_file); +  c->lex.current_file = save_current_file; + } +    static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,    struct svalue *other,    char *msg, ...)
3767:    old_pragmas = c->lex.pragmas;    c->lex.pragmas = (old_pragmas & ~ID_SAVE_PARENT)|ID_DONT_SAVE_PARENT;    -  copy_shared_string(save_current_file, c->lex.current_file); -  save_current_line = c->lex.current_line; -  +     /* Start the new program. */    low_start_new_program(p, 1, NULL, 0, NULL);    p = Pike_compiler->new_program;
3787:       debug_malloc_touch(p);    +  copy_shared_string(save_current_file, c->lex.current_file); +  save_current_line = c->lex.current_line; +  +  SET_ONERROR(err2, restore_current_file, save_current_file); +     if (!delayed_enc_val) {    struct svalue prog;    prog.type=T_PROGRAM;
4414:    }       /* Restore c->lex. */ -  free_string(c->lex.current_file); -  c->lex.current_file = save_current_file; +  CALL_AND_UNSET_ONERROR(err2);    c->lex.current_line = save_current_line;      #ifdef ENCODE_DEBUG