From 321b5dce853e856df342cc8bddea0dab1f7193b2 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 5639fd12..c91af04d 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 aac01ac8..dda91c72 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 f976455f..3924e41e 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 55a8a8d2..fb3ccd45 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 92a49ef8..69f80beb 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