libplumb: fix old leak introduced in 18b8ed1a5ea3

This commit is contained in:
mischief 2018-05-03 01:26:09 -07:00
parent 02e584c06c
commit 12716019bf

View file

@ -95,8 +95,10 @@ plumbpackattr(Plumbattr *attr)
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){