From 9bcaed0e8275708791e1760d85d18ff2a46f78ab Mon Sep 17 00:00:00 2001
From: Tim Ruehsen
Date: Mon, 4 Jun 2012 12:25:30 +0200
Subject: [PATCH] * fix a few little dissonances
---
src/ChangeLog | 8 ++++++++
src/main.c | 2 +-
src/openssl.c | 2 +-
src/utils.c | 4 ++--
src/warc.c | 6 ++++++
5 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 5639fd1..2914d7f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2012-06-04 Tim Ruehsen
+
+ * main.c (main): Check for filename != NULL
+ * warc.c (warc_process_cdx_line): Fix memory leak
+ * utils.c (match_posix_regex, compile_posix_regex): Remove dead
+ assignment
+ * openssl.c (ssl_init): Fix old-style function definition
+
2012-06-02 Giuseppe Scrivano
* connect.c: Include and .
diff --git a/src/main.c b/src/main.c
index aac01ac..bcb5016 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1566,7 +1566,7 @@ outputting to a regular file.\n"));
&dt, opt.recursive, iri, true);
}
- if (opt.delete_after && file_exists_p(filename))
+ if (opt.delete_after && filename != NULL && file_exists_p(filename))
{
DEBUGP (("Removing file due to --delete-after in main():\n"));
logprintf (LOG_VERBOSE, _("Removing %s.\n"), filename);
diff --git a/src/openssl.c b/src/openssl.c
index f976455..3924e41 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -159,7 +159,7 @@ key_type_to_ssl_type (enum keyfile_type type)
Returns true on success, false otherwise. */
bool
-ssl_init ()
+ssl_init (void)
{
SSL_METHOD const *meth;
diff --git a/src/utils.c b/src/utils.c
index 9e8c18d..36527a1 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -2355,7 +2355,7 @@ compile_posix_regex (const char *str)
{
int errbuf_size = regerror (errcode, (regex_t *) regex, NULL, 0);
char *errbuf = xmalloc (errbuf_size);
- errbuf_size = regerror (errcode, (regex_t *) regex, errbuf, errbuf_size);
+ regerror (errcode, (regex_t *) regex, errbuf, errbuf_size);
fprintf (stderr, _("Invalid regular expression %s, %s\n"),
quote (str), errbuf);
xfree (errbuf);
@@ -2402,7 +2402,7 @@ match_posix_regex (const void *regex, const char *str)
{
int errbuf_size = regerror (rc, opt.acceptregex, NULL, 0);
char *errbuf = xmalloc (errbuf_size);
- errbuf_size = regerror (rc, opt.acceptregex, errbuf, errbuf_size);
+ regerror (rc, opt.acceptregex, errbuf, errbuf_size);
logprintf (LOG_VERBOSE, _("Error while matching %s: %d\n"),
quote (str), rc);
xfree (errbuf);
diff --git a/src/warc.c b/src/warc.c
index 92a49ef..69f80be 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -913,6 +913,12 @@ warc_process_cdx_line (char *lineptr, int field_num_original_url,
free (record_id);
}
}
+ else
+ {
+ xfree_null(checksum);
+ xfree_null(original_url);
+ xfree_null(record_id);
+ }
}
/* Loads the CDX file from opt.warc_cdx_dedup_filename and fills
--
1.7.10