- fixed some compiler warnings and memory leaks
This commit is contained in:
parent
97d151a91f
commit
90ff03506e
@ -1,6 +1,6 @@
|
||||
diff -up man-db-2.6.2/src/globbing.c.wildcards man-db-2.6.2/src/globbing.c
|
||||
--- man-db-2.6.2/src/globbing.c.wildcards 2010-09-26 23:08:14.000000000 +0200
|
||||
+++ man-db-2.6.2/src/globbing.c 2012-07-20 19:18:20.000000000 +0200
|
||||
diff -upr man-db-2.6.3.orig/src/globbing.c man-db-2.6.3/src/globbing.c
|
||||
--- man-db-2.6.3.orig/src/globbing.c 2010-09-26 23:08:14.000000000 +0200
|
||||
+++ man-db-2.6.3/src/globbing.c 2013-03-13 18:18:52.615033484 +0100
|
||||
@@ -427,3 +427,30 @@ char **look_for_file (const char *hier,
|
||||
else
|
||||
return gbuf.gl_pathv;
|
||||
@ -15,13 +15,13 @@ diff -up man-db-2.6.2/src/globbing.c.wildcards man-db-2.6.2/src/globbing.c
|
||||
+ res = glob (path, 0, NULL, &globbuf);
|
||||
+ /* if glob failed, return the given path */
|
||||
+ if (res != 0) {
|
||||
+ result = (char **) xmalloc (2 * sizeof(char **));
|
||||
+ result = (char **) xmalloc (2 * sizeof(char *));
|
||||
+ result[0] = xstrndup (path, strlen(path));
|
||||
+ result[1] = NULL;
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ result = (char **) xmalloc ((globbuf.gl_pathc + 1) * sizeof(char **));
|
||||
+ result = (char **) xmalloc ((globbuf.gl_pathc + 1) * sizeof(char *));
|
||||
+ size_t i;
|
||||
+ for (i = 0; i < globbuf.gl_pathc; i++) {
|
||||
+ result[i] = xstrndup (globbuf.gl_pathv[i], strlen (globbuf.gl_pathv[i]));
|
||||
@ -32,9 +32,9 @@ diff -up man-db-2.6.2/src/globbing.c.wildcards man-db-2.6.2/src/globbing.c
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
diff -up man-db-2.6.2/src/globbing.h.wildcards man-db-2.6.2/src/globbing.h
|
||||
--- man-db-2.6.2/src/globbing.h.wildcards 2008-12-11 00:06:18.000000000 +0100
|
||||
+++ man-db-2.6.2/src/globbing.h 2012-07-20 19:18:20.000000000 +0200
|
||||
diff -upr man-db-2.6.3.orig/src/globbing.h man-db-2.6.3/src/globbing.h
|
||||
--- man-db-2.6.3.orig/src/globbing.h 2008-12-11 00:06:18.000000000 +0100
|
||||
+++ man-db-2.6.3/src/globbing.h 2013-03-13 18:18:52.615033484 +0100
|
||||
@@ -29,3 +29,6 @@ enum look_for_file_opts {
|
||||
/* globbing.c */
|
||||
extern char **look_for_file (const char *hier, const char *sec,
|
||||
@ -42,9 +42,9 @@ diff -up man-db-2.6.2/src/globbing.h.wildcards man-db-2.6.2/src/globbing.h
|
||||
+
|
||||
+/* Expand path with wildcards into list of all existing directories. */
|
||||
+extern char **expand_path (const char *path);
|
||||
diff -up man-db-2.6.2/src/Makefile.am.wildcards man-db-2.6.2/src/Makefile.am
|
||||
--- man-db-2.6.2/src/Makefile.am.wildcards 2012-02-05 14:25:20.000000000 +0100
|
||||
+++ man-db-2.6.2/src/Makefile.am 2012-07-20 19:18:20.000000000 +0200
|
||||
diff -upr man-db-2.6.3.orig/src/Makefile.am man-db-2.6.3/src/Makefile.am
|
||||
--- man-db-2.6.3.orig/src/Makefile.am 2012-02-05 14:25:20.000000000 +0100
|
||||
+++ man-db-2.6.3/src/Makefile.am 2013-03-13 18:18:52.617033454 +0100
|
||||
@@ -72,6 +72,8 @@ zsoelim_LDADD = $(LIBMAN) $(libpipeline_
|
||||
accessdb_SOURCES = \
|
||||
accessdb.c
|
||||
@ -69,9 +69,9 @@ diff -up man-db-2.6.2/src/Makefile.am.wildcards man-db-2.6.2/src/Makefile.am
|
||||
manconv.c \
|
||||
manconv.h \
|
||||
manp.c \
|
||||
diff -up man-db-2.6.2/src/Makefile.in.wildcards man-db-2.6.2/src/Makefile.in
|
||||
--- man-db-2.6.2/src/Makefile.in.wildcards 2012-06-18 14:39:42.000000000 +0200
|
||||
+++ man-db-2.6.2/src/Makefile.in 2012-07-20 19:20:29.000000000 +0200
|
||||
diff -upr man-db-2.6.3.orig/src/Makefile.in man-db-2.6.3/src/Makefile.in
|
||||
--- man-db-2.6.3.orig/src/Makefile.in 2012-09-18 00:34:03.000000000 +0200
|
||||
+++ man-db-2.6.3/src/Makefile.in 2013-03-13 18:20:57.097203869 +0100
|
||||
@@ -251,7 +251,7 @@ accessdb_DEPENDENCIES = $(am__DEPENDENCI
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
@ -94,7 +94,7 @@ diff -up man-db-2.6.2/src/Makefile.in.wildcards man-db-2.6.2/src/Makefile.in
|
||||
whatis_OBJECTS = $(am_whatis_OBJECTS)
|
||||
whatis_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) \
|
||||
$(am__DEPENDENCIES_2)
|
||||
@@ -1340,6 +1340,8 @@ accessdb_SOURCES = \
|
||||
@@ -1339,6 +1339,8 @@ accessdb_SOURCES = \
|
||||
|
||||
catman_SOURCES = \
|
||||
catman.c \
|
||||
@ -103,7 +103,7 @@ diff -up man-db-2.6.2/src/Makefile.in.wildcards man-db-2.6.2/src/Makefile.in
|
||||
manp.c \
|
||||
manp.h
|
||||
|
||||
@@ -1413,11 +1415,15 @@ mandb_SOURCES = \
|
||||
@@ -1412,11 +1414,15 @@ mandb_SOURCES = \
|
||||
ult_src.h
|
||||
|
||||
manpath_SOURCES = \
|
||||
@ -119,9 +119,9 @@ diff -up man-db-2.6.2/src/Makefile.in.wildcards man-db-2.6.2/src/Makefile.in
|
||||
manconv.c \
|
||||
manconv.h \
|
||||
manp.c \
|
||||
diff -up man-db-2.6.2/src/manp.c.wildcards man-db-2.6.2/src/manp.c
|
||||
--- man-db-2.6.2/src/manp.c.wildcards 2012-02-05 14:18:59.000000000 +0100
|
||||
+++ man-db-2.6.2/src/manp.c 2012-07-20 19:18:20.000000000 +0200
|
||||
diff -upr man-db-2.6.3.orig/src/manp.c man-db-2.6.3/src/manp.c
|
||||
--- man-db-2.6.3.orig/src/manp.c 2012-02-05 14:18:59.000000000 +0100
|
||||
+++ man-db-2.6.3/src/manp.c 2013-03-13 18:18:52.652032940 +0100
|
||||
@@ -75,6 +75,7 @@
|
||||
#endif
|
||||
|
||||
@ -155,7 +155,7 @@ diff -up man-db-2.6.2/src/manp.c.wildcards man-db-2.6.2/src/manp.c
|
||||
+ gripe_overlong_list ();
|
||||
+ if (!strcmp (*lp, d)) {
|
||||
+ debug ("%s is already in the manpath\n", d);
|
||||
+ return;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ lp++;
|
||||
+ pos++;
|
||||
@ -166,16 +166,9 @@ diff -up man-db-2.6.2/src/manp.c.wildcards man-db-2.6.2/src/manp.c
|
||||
|
||||
- /* Not found -- add it. */
|
||||
+ /* Not found -- add it. */
|
||||
+
|
||||
+ status = is_directory (d);
|
||||
|
||||
- status = is_directory (dir);
|
||||
+ if (status < 0)
|
||||
+ gripe_stat_file (d);
|
||||
+ else if (status == 0)
|
||||
+ gripe_not_directory (d);
|
||||
+ else if (status == 1) {
|
||||
+ debug ("adding %s to manpath\n", d);
|
||||
+ status = is_directory (d);
|
||||
|
||||
- if (status < 0)
|
||||
- gripe_stat_file (dir);
|
||||
@ -183,20 +176,27 @@ diff -up man-db-2.6.2/src/manp.c.wildcards man-db-2.6.2/src/manp.c
|
||||
- gripe_not_directory (dir);
|
||||
- else if (status == 1) {
|
||||
- debug ("adding %s to manpath\n", dir);
|
||||
+ *lp = xstrdup (d);
|
||||
+ }
|
||||
+ if (status < 0)
|
||||
+ gripe_stat_file (d);
|
||||
+ else if (status == 0)
|
||||
+ gripe_not_directory (d);
|
||||
+ else if (status == 1) {
|
||||
+ debug ("adding %s to manpath\n", d);
|
||||
|
||||
- *lp = xstrdup (dir);
|
||||
+ free (d);
|
||||
+ *lp = xstrdup (d);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ /* free also the last NULL pointer */
|
||||
+ free (expanded_dirs[i]);
|
||||
+done:
|
||||
+ for (i = 0; expanded_dirs[i] != NULL; i++) {
|
||||
+ free (expanded_dirs[i]);
|
||||
+ }
|
||||
+ free (expanded_dirs);
|
||||
}
|
||||
|
||||
/* path does not exist in config file: check to see if path/../man,
|
||||
@@ -1104,33 +1118,47 @@ static inline char *has_mandir (const ch
|
||||
@@ -1104,33 +1118,44 @@ static inline char *has_mandir (const ch
|
||||
|
||||
static char **add_dir_to_path_list (char **mphead, char **mp, const char *p)
|
||||
{
|
||||
@ -255,11 +255,20 @@ diff -up man-db-2.6.2/src/manp.c.wildcards man-db-2.6.2/src/manp.c
|
||||
- mp++;
|
||||
+ free (d);
|
||||
}
|
||||
+
|
||||
+ /* free also the last NULL pointer */
|
||||
+ free (expanded_dirs[i]);
|
||||
+ free (expanded_dirs);
|
||||
+
|
||||
return mp;
|
||||
}
|
||||
|
||||
diff -up man-db-2.6.3/src/tests/mandb-3.wildcards man-db-2.6.3/src/tests/mandb-3
|
||||
--- man-db-2.6.3/src/tests/mandb-3.wildcards 2010-11-14 23:11:27.000000000 +0100
|
||||
+++ man-db-2.6.3/src/tests/mandb-3 2013-03-18 13:39:23.822367377 +0100
|
||||
@@ -33,7 +33,7 @@ MANPATH="$tmpdir/usr/share/man" run $MAN
|
||||
"$tmpdir/usr/share/man"
|
||||
cat >"$tmpdir/2.exp" <<EOF
|
||||
test -> "- 1 1 MTIME A - - gz test page"
|
||||
-testlink -> "- 1 1 MTIME C test - gz "
|
||||
+testlink -> "- 1 1 MTIME A - - gz link to test page"
|
||||
EOF
|
||||
accessdb_filter "$tmpdir/usr/share/man/index$db_ext" >"$tmpdir/2.out"
|
||||
expect_pass 'broken whatis' 'diff -u "$tmpdir/2.exp" "$tmpdir/2.out"'
|
||||
|
28
man-db-2.6.3-gcc.patch
Normal file
28
man-db-2.6.3-gcc.patch
Normal file
@ -0,0 +1,28 @@
|
||||
diff -up man-db-2.6.3/src/check_mandirs.c.gcc man-db-2.6.3/src/check_mandirs.c
|
||||
--- man-db-2.6.3/src/check_mandirs.c.gcc 2013-03-18 13:56:24.000000000 +0100
|
||||
+++ man-db-2.6.3/src/check_mandirs.c 2013-03-18 14:03:20.081132550 +0100
|
||||
@@ -440,7 +440,10 @@ static int testmandirs (const char *path
|
||||
return 0;
|
||||
}
|
||||
|
||||
- chdir (path);
|
||||
+ if (chdir (path) != 0) {
|
||||
+ error (0, errno, _("can't change to directory %s"), path);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
while( (mandir = readdir (dir)) ) {
|
||||
if (strncmp (mandir->d_name, "man", 3) != 0)
|
||||
diff -up man-db-2.6.3/src/descriptions_store.c.gcc man-db-2.6.3/src/descriptions_store.c
|
||||
--- man-db-2.6.3/src/descriptions_store.c.gcc 2011-04-10 03:02:26.000000000 +0200
|
||||
+++ man-db-2.6.3/src/descriptions_store.c 2013-03-18 13:53:03.889580350 +0100
|
||||
@@ -71,7 +71,7 @@ void store_descriptions (const struct pa
|
||||
|
||||
if (trace) {
|
||||
for (i = 0; i < trace->len; ++i)
|
||||
- debug ("trace->names[%d] = '%s'\n",
|
||||
+ debug ("trace->names[%zu] = '%s'\n",
|
||||
i, trace->names[i]);
|
||||
}
|
||||
|
||||
diff -up man-db-2.6.3/src/man.c.gcc man-db-2.6.3/src/man.c
|
364
man-db-2.6.3-valgrind.patch
Normal file
364
man-db-2.6.3-valgrind.patch
Normal file
@ -0,0 +1,364 @@
|
||||
diff -up man-db-2.6.3/lib/encodings.c.valgrind-mem man-db-2.6.3/lib/encodings.c
|
||||
--- man-db-2.6.3/lib/encodings.c.valgrind-mem 2013-03-21 12:14:17.531719767 +0100
|
||||
+++ man-db-2.6.3/lib/encodings.c 2013-03-21 12:14:17.546719544 +0100
|
||||
@@ -559,6 +559,7 @@ const char *get_locale_charset (void)
|
||||
|
||||
/* Restore LC_CTYPE to its value on entry to this function. */
|
||||
setlocale (LC_CTYPE, saved_locale);
|
||||
+ free (saved_locale);
|
||||
|
||||
if (charset && *charset)
|
||||
return get_canonical_charset_name (charset);
|
||||
@@ -596,9 +597,12 @@ char *find_charset_locale (const char *c
|
||||
locale = xstrdup("en_US.UTF-8");
|
||||
if (setlocale (LC_CTYPE, locale)) {
|
||||
setlocale (LC_CTYPE, saved_locale);
|
||||
+ free (saved_locale);
|
||||
return locale;
|
||||
}
|
||||
}
|
||||
+ free (saved_locale);
|
||||
+ free (locale);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -628,6 +632,7 @@ char *find_charset_locale (const char *c
|
||||
|
||||
out:
|
||||
setlocale (LC_CTYPE, saved_locale);
|
||||
+ free (saved_locale);
|
||||
fclose (supported);
|
||||
return locale;
|
||||
}
|
||||
diff -up man-db-2.6.3/src/check_mandirs.c.valgrind-mem man-db-2.6.3/src/check_mandirs.c
|
||||
--- man-db-2.6.3/src/check_mandirs.c.valgrind-mem 2013-03-21 12:14:17.543719588 +0100
|
||||
+++ man-db-2.6.3/src/check_mandirs.c 2013-03-21 12:14:17.547719529 +0100
|
||||
@@ -442,6 +442,7 @@ static int testmandirs (const char *path
|
||||
|
||||
if (chdir (path) != 0) {
|
||||
error (0, errno, _("can't change to directory %s"), path);
|
||||
+ closedir (dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -479,11 +480,13 @@ static int testmandirs (const char *path
|
||||
if (errno == EACCES || errno == EROFS) {
|
||||
debug ("database %s is read-only\n",
|
||||
database);
|
||||
+ closedir (dir);
|
||||
return 0;
|
||||
} else {
|
||||
error (0, errno,
|
||||
_("can't create index cache %s"),
|
||||
database);
|
||||
+ closedir (dir);
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
@@ -496,6 +499,7 @@ static int testmandirs (const char *path
|
||||
|
||||
if (!dbf) {
|
||||
gripe_rwopen_failed ();
|
||||
+ closedir (dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff -up man-db-2.6.3/src/manconv_client.c.valgrind-mem man-db-2.6.3/src/manconv_client.c
|
||||
--- man-db-2.6.3/src/manconv_client.c.valgrind-mem 2011-01-04 04:04:50.000000000 +0100
|
||||
+++ man-db-2.6.3/src/manconv_client.c 2013-03-21 12:14:17.548719514 +0100
|
||||
@@ -111,8 +111,10 @@ void add_manconv (pipeline *p, const cha
|
||||
char *name;
|
||||
pipecmd *cmd;
|
||||
|
||||
- if (STREQ (source, "UTF-8") && STREQ (target, "UTF-8"))
|
||||
+ if (STREQ (source, "UTF-8") && STREQ (target, "UTF-8")) {
|
||||
+ free (codes);
|
||||
return;
|
||||
+ }
|
||||
|
||||
/* informational only; no shell quoting concerns */
|
||||
name = appendstr (NULL, MANCONV, " -f ", NULL);
|
||||
diff -up man-db-2.6.3/src/man.c.valgrind-mem man-db-2.6.3/src/man.c
|
||||
--- man-db-2.6.3/src/man.c.valgrind-mem 2013-03-21 12:14:17.536719693 +0100
|
||||
+++ man-db-2.6.3/src/man.c 2013-03-21 15:18:53.182891340 +0100
|
||||
@@ -188,7 +188,7 @@ static char *manpathlist[MAXDIRS];
|
||||
/* globals */
|
||||
int quiet = 1;
|
||||
char *program_name;
|
||||
-char *database;
|
||||
+char *database = NULL;
|
||||
MYDBM_FILE dbf;
|
||||
extern const char *extension; /* for globbing.c */
|
||||
extern char *user_config_file; /* defined in manp.c */
|
||||
@@ -207,7 +207,7 @@ static char *internal_locale, *multiple_
|
||||
static const char *prompt_string;
|
||||
static char *less;
|
||||
static const char *std_sections[] = STD_SECTIONS;
|
||||
-static char *manp;
|
||||
+static char *manp = NULL;
|
||||
static const char *external;
|
||||
static struct hashtable *db_hash = NULL;
|
||||
|
||||
@@ -950,7 +950,7 @@ static int local_man_loop (const char *a
|
||||
|
||||
if (directory_on_path (argv_dir)) {
|
||||
char *argv_base = base_name (argv);
|
||||
- char *new_manp;
|
||||
+ char *new_manp, *nm;
|
||||
char **old_manpathlist, **mp;
|
||||
|
||||
debug ("recalculating manpath for executable "
|
||||
@@ -962,7 +962,9 @@ static int local_man_loop (const char *a
|
||||
"executable\n");
|
||||
goto executable_out;
|
||||
}
|
||||
- new_manp = locale_manpath (new_manp);
|
||||
+ nm = locale_manpath (new_manp);
|
||||
+ free (new_manp);
|
||||
+ new_manp = nm;
|
||||
|
||||
old_manpathlist = XNMALLOC (MAXDIRS, char *);
|
||||
memcpy (old_manpathlist, manpathlist,
|
||||
@@ -1167,14 +1169,21 @@ int main (int argc, char *argv[])
|
||||
manp = get_manpath ("");
|
||||
printf ("%s\n", manp);
|
||||
exit (OK);
|
||||
- } else
|
||||
+ } else {
|
||||
+ free (cwd);
|
||||
+ free (internal_locale);
|
||||
+ free (program_name);
|
||||
gripe_no_name (NULL);
|
||||
+ }
|
||||
}
|
||||
|
||||
section_list = get_section_list ();
|
||||
|
||||
- if (manp == NULL)
|
||||
- manp = locale_manpath (get_manpath (alt_system_name));
|
||||
+ if (manp == NULL) {
|
||||
+ char *mp = get_manpath (alt_system_name);
|
||||
+ manp = locale_manpath (mp);
|
||||
+ free (mp);
|
||||
+ }
|
||||
else
|
||||
free (get_manpath (NULL));
|
||||
|
||||
@@ -1350,6 +1359,14 @@ int main (int argc, char *argv[])
|
||||
if (cwd[0])
|
||||
chdir (cwd);
|
||||
|
||||
+ if (database) {
|
||||
+ free (database);
|
||||
+ database = NULL;
|
||||
+ }
|
||||
+ if (manp) {
|
||||
+ free (manp);
|
||||
+ manp = NULL;
|
||||
+ }
|
||||
free_pathlist (manpathlist);
|
||||
free (cwd);
|
||||
free (internal_locale);
|
||||
@@ -1810,6 +1827,9 @@ static pipeline *make_roff_command (cons
|
||||
pipeline_command (p, cmd);
|
||||
}
|
||||
|
||||
+ /* free pp_string */
|
||||
+ get_preprocessors_from_file(NULL);
|
||||
+
|
||||
free (page_encoding);
|
||||
return p;
|
||||
}
|
||||
@@ -2327,6 +2347,7 @@ static void format_display (pipeline *de
|
||||
htmldir);
|
||||
free (htmlfile);
|
||||
free (htmldir);
|
||||
+ free (old_cwd);
|
||||
} else
|
||||
#endif /* TROFF_IS_GROFF */
|
||||
/* TODO: check format_cmd status too? */
|
||||
@@ -2498,6 +2519,7 @@ static int display (const char *dir, con
|
||||
free (name);
|
||||
free_locale_bits (&bits);
|
||||
}
|
||||
+ free (page_lang);
|
||||
}
|
||||
#endif /* TROFF_IS_GROFF */
|
||||
|
||||
@@ -2564,6 +2586,7 @@ static int display (const char *dir, con
|
||||
if (prompt && do_prompt (title)) {
|
||||
pipeline_free (format_cmd);
|
||||
pipeline_free (decomp);
|
||||
+ free (formatted_encoding);
|
||||
return 0;
|
||||
}
|
||||
drop_effective_privs ();
|
||||
@@ -2690,6 +2713,7 @@ static int display (const char *dir, con
|
||||
if (prompt && do_prompt (title)) {
|
||||
pipeline_free (format_cmd);
|
||||
pipeline_free (decomp);
|
||||
+ free (formatted_encoding);
|
||||
if (local_man_file)
|
||||
return 1;
|
||||
else
|
||||
@@ -2741,6 +2765,8 @@ static int display (const char *dir, con
|
||||
}
|
||||
}
|
||||
|
||||
+ free (formatted_encoding);
|
||||
+
|
||||
pipeline_free (format_cmd);
|
||||
pipeline_free (decomp);
|
||||
|
||||
@@ -2802,6 +2828,7 @@ static char *find_cat_file (const char *
|
||||
*tmp = 0;
|
||||
if (is_directory (cat_dir)) {
|
||||
debug ("will try cat file %s\n", cat_file);
|
||||
+ free (cat_dir);
|
||||
return cat_file;
|
||||
} else
|
||||
debug ("cat dir %s does not exist\n", cat_dir);
|
||||
@@ -3272,6 +3299,7 @@ static int try_section (const char *path
|
||||
}
|
||||
}
|
||||
|
||||
+ int f;
|
||||
for (np = names; np && *np; np++) {
|
||||
struct mandata *info = infoalloc ();
|
||||
char *info_buffer = filename_info (*np, info, name);
|
||||
@@ -3300,8 +3328,15 @@ static int try_section (const char *path
|
||||
else
|
||||
info->id = SO_MAN;
|
||||
|
||||
- found += add_candidate (cand_head, CANDIDATE_FILESYSTEM,
|
||||
+ f = add_candidate (cand_head, CANDIDATE_FILESYSTEM,
|
||||
cat, name, path, ult, info);
|
||||
+ found += f;
|
||||
+ /* Free info and info_buffer if it wasn't added to the candidates. */
|
||||
+ if (f == 0) {
|
||||
+ free (info_buffer);
|
||||
+ info->addr = NULL;
|
||||
+ free_mandata_struct (info);
|
||||
+ }
|
||||
/* Don't free info and info_buffer here. */
|
||||
}
|
||||
|
||||
@@ -3319,9 +3354,13 @@ static int display_filesystem (struct ca
|
||||
char *title = appendstr (NULL, candp->source->name,
|
||||
"(", candp->source->ext, ")", NULL);
|
||||
if (candp->cat) {
|
||||
- if (troff || want_encoding || recode)
|
||||
+ if (troff || want_encoding || recode) {
|
||||
+ free (title);
|
||||
return 0;
|
||||
- return display (candp->path, NULL, filename, title, NULL);
|
||||
+ }
|
||||
+ int r = display (candp->path, NULL, filename, title, NULL);
|
||||
+ free (title);
|
||||
+ return r;
|
||||
} else {
|
||||
const char *man_file;
|
||||
char *cat_file;
|
||||
@@ -3344,6 +3383,7 @@ static int display_filesystem (struct ca
|
||||
free (lang);
|
||||
lang = NULL;
|
||||
free (title);
|
||||
+ free (filename);
|
||||
|
||||
return found;
|
||||
}
|
||||
@@ -3571,6 +3611,10 @@ static int try_db (const char *manpath,
|
||||
/* find out where our db for this manpath should be */
|
||||
|
||||
catpath = get_catpath (manpath, global_manpath ? SYSTEM_CAT : USER_CAT);
|
||||
+ if (database) {
|
||||
+ free (database);
|
||||
+ database = NULL;
|
||||
+ }
|
||||
if (catpath) {
|
||||
database = mkdbname (catpath);
|
||||
free (catpath);
|
||||
@@ -3942,7 +3986,8 @@ static int man (const char *name, int *f
|
||||
|
||||
for (cand = candidates; cand; cand = candnext) {
|
||||
candnext = cand->next;
|
||||
- free (cand);
|
||||
+ free_mandata_struct (cand->source);
|
||||
+ free_candidate (cand);
|
||||
}
|
||||
|
||||
return *found ? OK : NOT_FOUND;
|
||||
diff -up man-db-2.6.3/src/mandb.c.valgrind-mem man-db-2.6.3/src/mandb.c
|
||||
--- man-db-2.6.3/src/mandb.c.valgrind-mem 2012-02-21 12:15:11.000000000 +0100
|
||||
+++ man-db-2.6.3/src/mandb.c 2013-03-21 12:14:17.552719454 +0100
|
||||
@@ -247,7 +247,7 @@ static int xcopy (const char *from, cons
|
||||
}
|
||||
|
||||
while (!feof (ifp) && !ferror (ifp)) {
|
||||
- char buf[32 * 1024];
|
||||
+ char buf[9 * 1024];
|
||||
size_t in = fread (buf, 1, sizeof (buf), ifp);
|
||||
if (in > 0) {
|
||||
if (fwrite (buf, 1, in, ofp) == 0 && ferror (ofp)) {
|
||||
diff -up man-db-2.6.3/src/manp.c.valgrind-mem man-db-2.6.3/src/manp.c
|
||||
--- man-db-2.6.3/src/manp.c.valgrind-mem 2013-03-21 12:14:17.540719633 +0100
|
||||
+++ man-db-2.6.3/src/manp.c 2013-03-21 12:14:17.553719440 +0100
|
||||
@@ -504,6 +504,7 @@ static char *get_nls_manpath (const char
|
||||
|
||||
closedir (mandir);
|
||||
}
|
||||
+ free (manpathlist_copy);
|
||||
|
||||
free_locale_bits (&lbits);
|
||||
return manpath;
|
||||
@@ -567,6 +568,7 @@ char *add_nls_manpaths (char *manpathlis
|
||||
free (locale_manpath);
|
||||
}
|
||||
}
|
||||
+ free (locales_copy);
|
||||
|
||||
/* Always try untranslated pages as a last resort. */
|
||||
locale_manpath = get_nls_manpath (manpathlist, "C");
|
||||
@@ -820,6 +822,11 @@ next:
|
||||
free (buf);
|
||||
buf = NULL;
|
||||
}
|
||||
+
|
||||
+ if (buf) {
|
||||
+ free (buf);
|
||||
+ buf = NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
static void free_config_file (void *unused ATTRIBUTE_UNUSED)
|
||||
diff -up man-db-2.6.3/src/whatis.c.valgrind-mem man-db-2.6.3/src/whatis.c
|
||||
--- man-db-2.6.3/src/whatis.c.valgrind-mem 2012-06-18 12:23:37.000000000 +0200
|
||||
+++ man-db-2.6.3/src/whatis.c 2013-03-21 12:14:17.556719395 +0100
|
||||
@@ -501,7 +501,7 @@ static inline int do_whatis_section (con
|
||||
|
||||
static int suitable_manpath (const char *manpath, const char *page_dir)
|
||||
{
|
||||
- char *page_manp;
|
||||
+ char *page_manp, *pm;
|
||||
char *page_manpathlist[MAXDIRS], **mp;
|
||||
int ret;
|
||||
|
||||
@@ -510,7 +510,9 @@ static int suitable_manpath (const char
|
||||
free (page_manp);
|
||||
return 0;
|
||||
}
|
||||
- page_manp = locale_manpath (page_manp);
|
||||
+ pm = locale_manpath (page_manp);
|
||||
+ free (page_manp);
|
||||
+ page_manp = pm;
|
||||
create_pathlist (page_manp, page_manpathlist);
|
||||
|
||||
ret = 0;
|
||||
@@ -554,6 +556,7 @@ static void do_whatis (const char * cons
|
||||
debug ("%s not on manpath for %s\n",
|
||||
manpath, page);
|
||||
free (page_dir);
|
||||
+ free (page);
|
||||
continue;
|
||||
}
|
||||
}
|
14
man-db.spec
14
man-db.spec
@ -4,7 +4,7 @@
|
||||
Summary: Tools for searching and reading man pages
|
||||
Name: man-db
|
||||
Version: 2.6.3
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
# GPLv2+ .. man-db
|
||||
# GPLv3+ .. gnulib
|
||||
License: GPLv2+ and GPLv3+
|
||||
@ -27,6 +27,10 @@ Patch3: man-db-2.6.1-locale-fallback.patch
|
||||
Patch4: man-db-2.6.2-invalid-cache.patch
|
||||
# adds support for man-pages-overrides
|
||||
Patch5: man-db-2.6.3-overrides.patch
|
||||
# fixed some compiler warnings
|
||||
Patch6: man-db-2.6.3-gcc.patch
|
||||
# fixed memory leaks detected by valgrind
|
||||
Patch7: man-db-2.6.3-valgrind.patch
|
||||
|
||||
Obsoletes: man < 2.0
|
||||
Provides: man = %{version}
|
||||
@ -53,6 +57,8 @@ manual pages.
|
||||
%patch3 -p1 -b .locale-fallback
|
||||
%patch4 -p1 -b .invalid-cache
|
||||
%patch5 -p1 -b .overrides
|
||||
%patch6 -p1 -b .gcc
|
||||
%patch7 -p1 -b .valgrind-mem
|
||||
|
||||
%build
|
||||
%configure \
|
||||
@ -60,6 +66,9 @@ manual pages.
|
||||
--disable-setuid --with-browser=elinks --with-lzip=lzip
|
||||
make CC="%{__cc} %{optflags}" %{?_smp_mflags} V=1
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%install
|
||||
make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} INSTALL='install -p'
|
||||
|
||||
@ -123,6 +132,9 @@ install -D -p -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/man-db
|
||||
%lang(it) %{_datadir}/man/it/man*/*
|
||||
|
||||
%changelog
|
||||
* Thu Mar 21 2013 Peter Schiffer <pschiffe@redhat.com> - 2.6.3-4
|
||||
- fixed some compiler warnings and memory leaks
|
||||
|
||||
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6.3-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user