diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index fce841394735a5d7bbee14bdebf4f4f1fbfed4c1..cd2c06ff2e4da465a5c5c31780bf94427fa17d9f 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -388,7 +388,8 @@ libwebsockets_get_addresses(struct libwebsocket_context *context,
 	if (addr4.sin_family == AF_UNSPEC)
 		return -1;
 
-	lws_plat_inet_ntop(AF_INET, &addr4.sin_addr, rip, rip_len);
+	if (lws_plat_inet_ntop(AF_INET, &addr4.sin_addr, rip, rip_len) == NULL)
+		return -1;
 
 	return 0;
 }
diff --git a/lib/parsers.c b/lib/parsers.c
index fca08514617715f014ec7000e8d2ba57f737224e..c50adfad31453bedce40c418c7cc8ef47b5f079f 100644
--- a/lib/parsers.c
+++ b/lib/parsers.c
@@ -281,7 +281,8 @@ int libwebsocket_parse(
 		case URIES_SEEN_PERCENT_H1:
 			if (char_to_hex(c) < 0) {
 				/* regurgitate */
-				issue_char(wsi, '%');
+				if (issue_char(wsi, '%') < 0)
+					return -1;
 				wsi->u.hdr.ues = URIES_IDLE;
 				/* regurgitate + assess */
 				if (libwebsocket_parse(context, wsi, wsi->u.hdr.esc_stash) < 0)