shithub: zuke

Download patch

ref: bb0b8b8fa1803e9801bafd08b4e6b67a4984ca8b
parent: fd78a755ba0b88e03fce01a478f31e12e2212d9e
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Nov 1 16:22:29 EST 2020

icy: deal with netmkaddr potentially returning nil

--- a/icy.c
+++ b/icy.c
@@ -12,9 +12,11 @@
 		*p = '!';
 	p = smprint("tcp!%s", s);
 	free(path);
-	d = netmkaddr(p, "tcp", "80");
+	f = -1;
+	if((d = netmkaddr(p, "tcp", "80")) != nil)
+		f = dial(d, nil, nil, nil);
 	free(p);
-	if((f = dial(d, nil, nil, nil)) < 0)
+	if(f < 0)
 		return -1;
 	fprint(f, "GET /%s HTTP/0.9\r\nIcy-MetaData: 1\r\n\r\n", e ? e : "");
 	s0 = malloc(4096);