summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-10 21:52:38 -0500
committerJune McEnroe <june@causal.agency>2020-02-10 21:52:38 -0500
commitf2530076c384d4f4885d0b80b86c26d52c6f9779 (patch)
tree608a670d395e995b6acc75a550fc1d006d1f94c0 /bin
parentAdd To Be Taught, If Fortunate (diff)
downloadsrc-f2530076c384d4f4885d0b80b86c26d52c6f9779.tar.gz
src-f2530076c384d4f4885d0b80b86c26d52c6f9779.zip
Duplicate effective URL before passing it back to curl
Apparently sometimes it didn't like receiving its own internal storage
to parse again. Understandable.
Diffstat (limited to 'bin')
-rw-r--r--bin/title.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/title.c b/bin/title.c
index 0208f862..d85fa9ac 100644
--- a/bin/title.c
+++ b/bin/title.c
@@ -127,8 +127,12 @@ static CURLcode fetchTitle(const char *url) {
 
 	char *dest;
 	curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &dest);
+	dest = strdup(dest);
+	if (!dest) err(EX_OSERR, "strdup");
+
 	code = curl_easy_setopt(curl, CURLOPT_URL, dest);
 	if (code) return code;
+	free(dest);
 
 	body.len = 0;
 	title = false;