shithub: riscv

Download patch

ref: 12716019bfdc3bedda1c8489d87a7cd316d016ef
parent: 02e584c06c507a7802ed160ff954fa9fd080265c
author: mischief <mischief@offblast.org>
date: Wed May 2 21:26:09 EDT 2018

libplumb: fix old leak introduced in 18b8ed1a5ea3

--- a/sys/src/libplumb/mesg.c
+++ b/sys/src/libplumb/mesg.c
@@ -95,8 +95,10 @@
 	for(a=attr; a!=nil; a=a->next)
 		n += Strlen(a->name) + 1 + Strlen(quote(a->value, buf, bufe)) + 1;
 	s = malloc(n);
-	if(s == nil)
+	if(s == nil){
+		free(buf);
 		return nil;
+	}
 	t = s;
 	*t = '\0';
 	for(a=attr; a!=nil; a=a->next){