>From 807b98d7d9289765c9f210336d2dbf294d663f99 Mon Sep 17 00:00:00 2001 From: Gijs van Tulder Date: Wed, 30 May 2012 23:00:04 +0200 Subject: [PATCH] warc: Fix segfault if CDX record is not found. --- src/ChangeLog | 4 ++++ src/warc.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7e16b17..9e74e47 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-05-30 Gijs van Tulder + + * warc.c: Fix segfault if CDX record is not found. + 2011-05-26 Steven Schweda * connect.c [HAVE_SYS_SOCKET_H]: Include . [HAVE_SYS_SELECT_H]: Include . diff --git a/src/warc.c b/src/warc.c index 24751db..92a49ef 100644 --- a/src/warc.c +++ b/src/warc.c @@ -1001,10 +1001,10 @@ warc_find_duplicate_cdx_record (char *url, char *sha1_digest_payload) char *key; struct warc_cdx_record *rec_existing; - hash_table_get_pair (warc_cdx_dedup_table, sha1_digest_payload, &key, - &rec_existing); + int found = hash_table_get_pair (warc_cdx_dedup_table, sha1_digest_payload, + &key, &rec_existing); - if (rec_existing != NULL && strcmp (rec_existing->url, url) == 0) + if (found && strcmp (rec_existing->url, url) == 0) return rec_existing; else return NULL; -- 1.7.4.1