[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: Fix many malloc/new vs. free/delete/delete[] mismatches (
From: |
Werner LEMBERG |
Subject: |
[groff] 01/01: Fix many malloc/new vs. free/delete/delete[] mismatches (#47164) |
Date: |
Tue, 16 Feb 2016 07:50:56 +0000 |
wl pushed a commit to branch master
in repository groff.
commit 165ca30005f7e62d52e09cb4cff8ee227072151c
Author: Bálint Réczey <address@hidden>
Date: Tue Feb 16 08:49:34 2016 +0100
Fix many malloc/new vs. free/delete/delete[] mismatches (#47164)
* src/devices/grops/ps.cpp (ps_font::~ps_font,
ps_printer::define_encoding): Use `free'.
* src/devices/grops/psrm.cpp (resource::~resource,
resource_manager::output_prolog, resource_manager::supply_resource,
resource_manager::read_download_file): Ditto.
* src/include/ptable.h (PTABLE::~PTABLE, PTABLE::define): Ditto.
* src/libs/libgroff/searchpath.cpp
(search_path::open_file_cautious): Ditto.
* src/libs/libgroff/string.cpp: Include `stdlib.h'.
(string::extract): Use `malloc'.
* src/preproc/eqn/box.cpp (quoted_text_box::~quoted_text_box): Use
`free'.
* src/preproc/eqn/lex.cpp (definition::~definition,
macro_input::~macro_input, top_input::~top_input, do_definition):
Ditto.
* src/preproc/eqn/main.cpp (main): Ditto.
* src/preproc/eqn/other.cpp: Include `stdlib.h'.
(size_box::~size_box, font_box::~font_box): Use `free'.
* src/preproc/eqn/text.cpp: Include `stdlib.h'.
(box::set_spacing_type, special_char_box::~special_char_box,
split_text): Use `free'.
* src/preproc/grn/main.cpp (conv): Use `free'.
* src/preproc/html/pre-html.cpp (get_resolution): Ditto.
* src/preproc/pic/lex.cpp (macro_input::~macro_input,
argument_macro_input::~argument_macro_input, for_input::~for_input):
Ditto.
* src/preproc/pic/main.cpp (do_picture): Ditto.
* src/preproc/pic/object.cpp: Include `stdlib.h'.
(text_piece::~text_piece, string_list::~string_list): Use `free'.
* src/preproc/pic/pic.ypp (placeless_element, element, text, label,
expr_not_lower_than): Ditto.
* src/preproc/pic/troff.cpp (troff_output::reset_color): Ditto.
* src/preproc/preconv/preconv.cpp (check_coding_tag): Ditto.
* src/preproc/soelim/soelim.cpp (do_file): Ditto.
* src/preproc/tbl/table.cpp (text_entry::~text_entry): Ditto.
* src/roff/groff/groff.cpp (possible_command::~possible_command,
possible_command::set_name): Ditto.
* src/roff/troff/env.cpp (hyphen_trie::read_patterns_file): Ditto.
* src/roff/troff/node.cpp (suppress_node::tprint): Ditto.
---
ChangeLog | 67 +++++++++++++++++++++++++++++++++++++-
src/devices/grops/ps.cpp | 4 +-
src/devices/grops/psrm.cpp | 8 ++--
src/include/ptable.h | 14 +++++---
src/libs/libgroff/searchpath.cpp | 4 +-
src/libs/libgroff/string.cpp | 4 ++-
src/preproc/eqn/box.cpp | 2 +-
src/preproc/eqn/lex.cpp | 8 ++--
src/preproc/eqn/main.cpp | 2 +-
src/preproc/eqn/other.cpp | 6 ++-
src/preproc/eqn/text.cpp | 7 ++--
src/preproc/grn/main.cpp | 2 +-
src/preproc/html/pre-html.cpp | 2 +-
src/preproc/pic/lex.cpp | 10 +++---
src/preproc/pic/main.cpp | 3 +-
src/preproc/pic/object.cpp | 6 ++-
src/preproc/pic/pic.ypp | 20 ++++++------
src/preproc/pic/troff.cpp | 4 +-
src/preproc/preconv/preconv.cpp | 4 +-
src/preproc/soelim/soelim.cpp | 2 +-
src/preproc/tbl/table.cpp | 2 +-
src/roff/groff/groff.cpp | 8 ++--
src/roff/troff/env.cpp | 2 +-
src/roff/troff/node.cpp | 2 +-
24 files changed, 135 insertions(+), 58 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 15bc013..e688ed0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,71 @@
2016-02-16 Bálint Réczey <address@hidden>
- Use `malloc' in `strsave'; use `free' for returned pointers.
+ Fix many malloc/new vs. free/delete/delete[] mismatches (#47164)
+
+ * src/devices/grops/ps.cpp (ps_font::~ps_font,
+ ps_printer::define_encoding): Use `free'.
+ * src/devices/grops/psrm.cpp (resource::~resource,
+ resource_manager::output_prolog, resource_manager::supply_resource,
+ resource_manager::read_download_file): Ditto.
+
+ * src/include/ptable.h (PTABLE::~PTABLE, PTABLE::define): Ditto.
+
+ * src/libs/libgroff/searchpath.cpp
+ (search_path::open_file_cautious): Ditto.
+
+ * src/libs/libgroff/string.cpp: Include `stdlib.h'.
+ (string::extract): Use `malloc'.
+
+ * src/preproc/eqn/box.cpp (quoted_text_box::~quoted_text_box): Use
+ `free'.
+
+ * src/preproc/eqn/lex.cpp (definition::~definition,
+ macro_input::~macro_input, top_input::~top_input, do_definition):
+ Ditto.
+
+ * src/preproc/eqn/main.cpp (main): Ditto.
+
+ * src/preproc/eqn/other.cpp: Include `stdlib.h'.
+ (size_box::~size_box, font_box::~font_box): Use `free'.
+
+ * src/preproc/eqn/text.cpp: Include `stdlib.h'.
+ (box::set_spacing_type, special_char_box::~special_char_box,
+ split_text): Use `free'.
+
+ * src/preproc/grn/main.cpp (conv): Use `free'.
+
+ * src/preproc/html/pre-html.cpp (get_resolution): Ditto.
+
+ * src/preproc/pic/lex.cpp (macro_input::~macro_input,
+ argument_macro_input::~argument_macro_input, for_input::~for_input):
+ Ditto.
+
+ * src/preproc/pic/main.cpp (do_picture): Ditto.
+
+ * src/preproc/pic/object.cpp: Include `stdlib.h'.
+ (text_piece::~text_piece, string_list::~string_list): Use `free'.
+
+ * src/preproc/pic/pic.ypp (placeless_element, element, text, label,
+ expr_not_lower_than): Ditto.
+
+ * src/preproc/pic/troff.cpp (troff_output::reset_color): Ditto.
+
+ * src/preproc/preconv/preconv.cpp (check_coding_tag): Ditto.
+
+ * src/preproc/soelim/soelim.cpp (do_file): Ditto.
+
+ * src/preproc/tbl/table.cpp (text_entry::~text_entry): Ditto.
+
+ * src/roff/groff/groff.cpp (possible_command::~possible_command,
+ possible_command::set_name): Ditto.
+
+ * src/roff/troff/env.cpp (hyphen_trie::read_patterns_file): Ditto.
+
+ * src/roff/troff/node.cpp (suppress_node::tprint): Ditto.
+
+2016-02-16 Bálint Réczey <address@hidden>
+
+ Use `malloc' in `strsave'; use `free' for returned pointers (#47164).
* src/libs/libgroff/font.cpp (text_file::~text_file): Use `free'.
diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp
index 745a503..1215100 100644
--- a/src/devices/grops/ps.cpp
+++ b/src/devices/grops/ps.cpp
@@ -430,7 +430,7 @@ ps_font::ps_font(const char *nm)
ps_font::~ps_font()
{
- a_delete encoding;
+ free(encoding);
a_delete reencoded_name;
}
@@ -803,7 +803,7 @@ void ps_printer::define_encoding(const char *encoding, int
encoding_index)
}
lineno++;
}
- a_delete path;
+ free(path);
out.put_literal_symbol(make_encoding_name(encoding_index))
.put_delimiter('[');
for (i = 0; i < 256; i++) {
diff --git a/src/devices/grops/psrm.cpp b/src/devices/grops/psrm.cpp
index 2c00b6c..4780236 100644
--- a/src/devices/grops/psrm.cpp
+++ b/src/devices/grops/psrm.cpp
@@ -150,7 +150,7 @@ resource::resource(resource_type t, string &n, string &v,
unsigned r)
resource::~resource()
{
- a_delete filename;
+ free(filename);
}
void resource::print_type_and_name(FILE *outfp)
@@ -323,7 +323,7 @@ void resource_manager::output_prolog(ps_output &out)
putc('\n', outfp);
process_file(-1, fp, path, outfp);
fclose(fp);
- a_delete path;
+ free(path);
fputs("%%EndResource\n", outfp);
}
@@ -386,7 +386,7 @@ void resource_manager::supply_resource(resource *r, int
rank, FILE *outfp,
process_file(rank, fp, path, outfp);
fclose(fp);
if (r->type == RESOURCE_FONT)
- a_delete path;
+ free(path);
if (outfp) {
if (r->type == RESOURCE_FILE && is_document)
fputs("%%EndDocument\n", outfp);
@@ -1090,7 +1090,7 @@ void resource_manager::read_download_file()
fatal_with_file_and_line(path, lineno, "missing filename");
lookup_font(p)->filename = strsave(q);
}
- a_delete path;
+ free(path);
fclose(fp);
}
diff --git a/src/include/ptable.h b/src/include/ptable.h
index c43a070..410a44c 100644
--- a/src/include/ptable.h
+++ b/src/include/ptable.h
@@ -133,8 +133,10 @@ PTABLE(T)::PTABLE(T)()
\
PTABLE(T)::~PTABLE(T)()
\
{ \
for (unsigned i = 0; i < size; i++) {
\
- a_delete v[i].key; \
- a_delete v[i].val; \
+ free(v[i].key); \
+ /* XXX leak, because we don't know whether */ \
+ /* `free', `delete', or `delete[]' should be used */ \
+ /* a_delete v[i].val; */ \
} \
a_delete v; \
} \
@@ -148,7 +150,9 @@ const char *PTABLE(T)::define(const char *key, T *val)
\
v[n].key != 0; \
n = (n == 0 ? size - 1 : n - 1))
\
if (strcmp(v[n].key, key) == 0) { \
- a_delete v[n].val; \
+ /* XXX leak, because we don't know whether */ \
+ /* `free', `delete', or `delete[]' should be used */ \
+ /* a_delete v[n].val; */ \
v[n].val = val; \
return v[n].key; \
} \
@@ -162,7 +166,7 @@ const char *PTABLE(T)::define(const char *key, T *val)
\
for (unsigned i = 0; i < old_size; i++) \
if (oldv[i].key != 0) { \
if (oldv[i].val == 0) \
- a_delete oldv[i].key; \
+ free(oldv[i].key); \
else { \
unsigned j; \
for (j = unsigned(hash_string(oldv[i].key) % size); \
@@ -179,7 +183,7 @@ const char *PTABLE(T)::define(const char *key, T *val)
\
;
\
a_delete oldv; \
} \
- char *temp = new char[strlen(key)+1];
\
+ char *temp = (char*)malloc(strlen(key)+1); \
strcpy(temp, key); \
v[n].key = temp; \
v[n].val = val; \
diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp
index 5bd1bbc..1ae0c68 100644
--- a/src/libs/libgroff/searchpath.cpp
+++ b/src/libs/libgroff/searchpath.cpp
@@ -187,11 +187,11 @@ FILE *search_path::open_file_cautious(const char *name,
char **pathp,
if (pathp)
*pathp = path;
else
- a_delete path;
+ free(path);
return fp;
}
int err = errno;
- a_delete path;
+ free(path);
if (err != ENOENT)
{
errno = err;
diff --git a/src/libs/libgroff/string.cpp b/src/libs/libgroff/string.cpp
index 5614c04..e2acf02 100644
--- a/src/libs/libgroff/string.cpp
+++ b/src/libs/libgroff/string.cpp
@@ -17,6 +17,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <stdlib.h>
+
#include "lib.h"
#include "stringclass.h"
@@ -286,7 +288,7 @@ char *string::extract() const
for (i = 0; i < n; i++)
if (p[i] == '\0')
nnuls++;
- char *q = new char[n + 1 - nnuls];
+ char *q =(char*)malloc(n + 1 - nnuls);
char *r = q;
for (i = 0; i < n; i++)
if (p[i] != '\0')
diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp
index a711ebc..0769137 100644
--- a/src/preproc/eqn/box.cpp
+++ b/src/preproc/eqn/box.cpp
@@ -551,7 +551,7 @@ quoted_text_box::quoted_text_box(char *s) : text(s)
quoted_text_box::~quoted_text_box()
{
- a_delete text;
+ free(text);
}
void quoted_text_box::output()
diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp
index bd5b2e0..1552326 100644
--- a/src/preproc/eqn/lex.cpp
+++ b/src/preproc/eqn/lex.cpp
@@ -47,7 +47,7 @@ definition::definition() : is_macro(1), is_simple(0)
definition::~definition()
{
if (is_macro)
- a_delete contents;
+ free(contents);
}
declare_ptable(definition)
@@ -471,7 +471,7 @@ macro_input::macro_input(const char *str, input *x) :
input(x)
macro_input::~macro_input()
{
- a_delete s;
+ free(s);
}
int macro_input::get()
@@ -498,7 +498,7 @@ top_input::top_input(const char *str, const char *fn, int
ln, input *x)
top_input::~top_input()
{
- a_delete filename;
+ free(filename);
}
int top_input::get()
@@ -963,7 +963,7 @@ void do_definition(int is_simple)
macro_table.define(name, def);
}
else if (def->is_macro) {
- a_delete def->contents;
+ free(def->contents);
}
get_delimited_text();
token_buffer += '\0';
diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp
index 0eb1535..44a8a9d 100644
--- a/src/preproc/eqn/main.cpp
+++ b/src/preproc/eqn/main.cpp
@@ -398,7 +398,7 @@ int main(int argc, char **argv)
if (fp) {
do_file(fp, path);
fclose(fp);
- a_delete path;
+ free(path);
}
}
if (optind >= argc)
diff --git a/src/preproc/eqn/other.cpp b/src/preproc/eqn/other.cpp
index 7e00b28..227afaf 100644
--- a/src/preproc/eqn/other.cpp
+++ b/src/preproc/eqn/other.cpp
@@ -17,6 +17,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <stdlib.h>
+
#include "eqn.h"
#include "pbox.h"
@@ -464,7 +466,7 @@ void size_box::output()
size_box::~size_box()
{
- a_delete size;
+ free(size);
}
void size_box::debug_print()
@@ -481,7 +483,7 @@ font_box::font_box(char *s, box *pp) : pointer_box(pp), f(s)
font_box::~font_box()
{
- a_delete f;
+ free(f);
}
int font_box::compute_metrics(int style)
diff --git a/src/preproc/eqn/text.cpp b/src/preproc/eqn/text.cpp
index 6607eb8..f25cc91 100644
--- a/src/preproc/eqn/text.cpp
+++ b/src/preproc/eqn/text.cpp
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public
License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
+#include <stdlib.h>
#include "eqn.h"
#include "pbox.h"
#include "ptable.h"
@@ -552,7 +553,7 @@ void box::set_spacing_type(char *type)
error("unrecognised type `%1'", type);
else
spacing_type = t;
- a_delete type;
+ free(type);
}
char_box::char_box(unsigned char cc)
@@ -647,7 +648,7 @@ special_char_box::special_char_box(const char *t)
special_char_box::~special_char_box()
{
- a_delete s;
+ free(s);
}
void special_char_box::output()
@@ -941,7 +942,7 @@ box *split_text(char *text)
fb = b;
}
}
- a_delete text;
+ free(text);
if (lb != 0)
return lb;
else if (fb != 0)
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index 55fc27a..a30da33 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -552,7 +552,7 @@ conv(register FILE *fp,
return;
PICTURE = DBRead(gfp); /* read picture file */
fclose(gfp);
- a_delete path;
+ free(path);
if (DBNullelt(PICTURE))
return; /* If a request is made to make the */
/* picture fit into a specific area, */
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 8698149..5a954bf 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -296,7 +296,7 @@ static unsigned int get_resolution(void)
FILE *f;
unsigned int res;
f = font_path.open_file("devps/DESC", &pathp);
- a_delete pathp;
+ free(pathp);
if (f == 0)
fatal("can't open devps/DESC");
while (get_line(f)) {
diff --git a/src/preproc/pic/lex.cpp b/src/preproc/pic/lex.cpp
index de20276..3b96d6e 100644
--- a/src/preproc/pic/lex.cpp
+++ b/src/preproc/pic/lex.cpp
@@ -148,7 +148,7 @@ macro_input::macro_input(const char *str)
macro_input::~macro_input()
{
- a_delete s;
+ free(s);
}
int macro_input::get()
@@ -208,8 +208,8 @@ argument_macro_input::argument_macro_input(const char
*body, int ac, char **av)
argument_macro_input::~argument_macro_input()
{
for (int i = 0; i < argc; i++)
- a_delete argv[i];
- a_delete s;
+ free(argv[i]);
+ free(s);
}
int argument_macro_input::get()
@@ -1387,8 +1387,8 @@ for_input::for_input(char *vr, double f, double t,
for_input::~for_input()
{
- a_delete var;
- a_delete body;
+ free(var);
+ free(body);
}
int for_input::get()
diff --git a/src/preproc/pic/main.cpp b/src/preproc/pic/main.cpp
index 1902840..0a8efa1 100644
--- a/src/preproc/pic/main.cpp
+++ b/src/preproc/pic/main.cpp
@@ -220,7 +220,8 @@ void do_picture(FILE *fp)
{
flyback_flag = 0;
int c;
- a_delete graphname;
+ if (!graphname)
+ free(graphname);
graphname = strsave("graph"); // default picture name in TeX
mode
while ((c = getc(fp)) == ' ')
;
diff --git a/src/preproc/pic/object.cpp b/src/preproc/pic/object.cpp
index 282546c..bbcf946 100644
--- a/src/preproc/pic/object.cpp
+++ b/src/preproc/pic/object.cpp
@@ -17,6 +17,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include <stdlib.h>
+
#include "pic.h"
#include "ptable.h"
#include "object.h"
@@ -540,7 +542,7 @@ text_piece::text_piece()
text_piece::~text_piece()
{
- a_delete text;
+ free(text);
}
class graphic_object : public object {
@@ -1958,7 +1960,7 @@ string_list::string_list(char *s)
string_list::~string_list()
{
- a_delete str;
+ free(str);
}
/* A path is used to hold the argument to the `with' attribute. For
diff --git a/src/preproc/pic/pic.ypp b/src/preproc/pic/pic.ypp
index cf3a0d2..8decce3 100644
--- a/src/preproc/pic/pic.ypp
+++ b/src/preproc/pic/pic.ypp
@@ -315,7 +315,7 @@ placeless_element:
VARIABLE '=' any_expr
{
define_variable($1, $3);
- a_delete $1;
+ free($1);
}
| VARIABLE ':' '=' any_expr
{
@@ -327,7 +327,7 @@ placeless_element:
p->obj = 0;
p->x = $4;
p->y = 0.0;
- a_delete $1;
+ free($1);
}
| UP
{ current_direction = UP_DIRECTION; }
@@ -424,8 +424,8 @@ placeless_element:
push_body($1.body);
else
push_body($4);
- a_delete $1.body;
- a_delete $4;
+ free($1.body);
+ free($4);
}
| reset_variables
| RESET
@@ -587,7 +587,7 @@ element:
{
$$ = $4;
define_label($1, & $$);
- a_delete $1;
+ free($1);
}
| LABEL ':' optional_separator position_not_place
{
@@ -595,13 +595,13 @@ element:
$$.x = $4.x;
$$.y = $4.y;
define_label($1, & $$);
- a_delete $1;
+ free($1);
}
| LABEL ':' optional_separator place
{
$$ = $4;
define_label($1, & $$);
- a_delete $1;
+ free($1);
}
| '{'
{
@@ -1110,7 +1110,7 @@ text:
$$.lineno = $3.lineno;
$$.str = do_sprintf($3.str, $4.v, $4.nv);
a_delete $4.v;
- a_delete $3.str;
+ free($3.str);
}
;
@@ -1272,7 +1272,7 @@ label:
YYABORT;
}
$$ = *p;
- a_delete $1;
+ free($1);
}
| nth_primitive
{ $$.obj = $1; }
@@ -1500,7 +1500,7 @@ expr_not_lower_than:
lex_error("there is no variable `%1'", $1);
YYABORT;
}
- a_delete $1;
+ free($1);
}
| NUMBER
{ $$ = $1; }
diff --git a/src/preproc/pic/troff.cpp b/src/preproc/pic/troff.cpp
index 112b94a..e7bf413 100644
--- a/src/preproc/pic/troff.cpp
+++ b/src/preproc/pic/troff.cpp
@@ -514,12 +514,12 @@ void troff_output::reset_color()
if (driver_extension_flag) {
if (last_filled) {
printf(".fcolor\n");
- a_delete last_filled;
+ free(last_filled);
last_filled = 0;
}
if (last_outlined) {
printf(".gcolor\n");
- a_delete last_outlined;
+ free(last_outlined);
last_outlined = 0;
}
}
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index 6e65a4b..2819b5e 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -987,13 +987,13 @@ check_coding_tag(FILE *fp, string &data)
d1 = get_variable_value_pair(d1, &variable, &value);
if (!strcasecmp(variable, "coding")) {
*d2 = '-'; // restore '-'
- a_delete inbuf;
+ free(inbuf);
return value;
}
}
*d2 = '-'; // restore '-'
}
- a_delete inbuf;
+ free(inbuf);
return NULL;
}
diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp
index 9b315c3..3c082c9 100644
--- a/src/preproc/soelim/soelim.cpp
+++ b/src/preproc/soelim/soelim.cpp
@@ -157,7 +157,7 @@ int do_file(const char *filename)
int err = errno;
string whole_filename(file_name_in_path ? file_name_in_path : filename);
whole_filename += '\0';
- a_delete file_name_in_path;
+ free(file_name_in_path);
if (fp == 0) {
error("can't open `%1': %2", whole_filename.contents(), strerror(err));
return 0;
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 436149b..10049d8 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -458,7 +458,7 @@ text_entry::text_entry(const table *p, const entry_modifier
*m, char *s)
text_entry::~text_entry()
{
- a_delete contents;
+ free(contents);
}
repeated_char_entry::repeated_char_entry(const table *p,
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index b36ceae..8065598 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -581,13 +581,13 @@ possible_command::possible_command()
possible_command::~possible_command()
{
- a_delete name;
+ free(name);
a_delete argv;
}
void possible_command::set_name(const char *s)
{
- a_delete name;
+ free(name);
name = strsave(s);
}
@@ -601,8 +601,8 @@ void possible_command::clear_name()
void possible_command::set_name(const char *s1, const char *s2)
{
- a_delete name;
- name = new char[strlen(s1) + strlen(s2) + 1];
+ free(name);
+ name = (char*)malloc(strlen(s1) + strlen(s2) + 1);
strcpy(name, s1);
strcat(name, s2);
}
diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp
index 1d8846f..40e994e 100644
--- a/src/roff/troff/env.cpp
+++ b/src/roff/troff/env.cpp
@@ -3923,7 +3923,7 @@ void hyphen_trie::read_patterns_file(const char *name,
int append,
}
}
fclose(fp);
- a_delete path;
+ free(path);
return;
}
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index a6ab1b5..e17289e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4080,7 +4080,7 @@ void suppress_node::tprint(troff_output_file *out)
char *tem = (char *)last_image_filename;
last_image_filename = strsave(filename.contents());
if (tem)
- a_delete tem;
+ free(tem);
last_image_id = image_id;
// printf("start of image and page = %d\n", current_page);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: Fix many malloc/new vs. free/delete/delete[] mismatches (#47164),
Werner LEMBERG <=