shithub: riscv

Download patch

ref: 49bd8a86f3a07c4f54df94838c07fa653d725afa
parent: e69ca9af535d935f0b9895dca43d50541a6ff504
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Oct 2 12:14:40 EDT 2023

git/fs: fix leak of uid strings

--- a/sys/src/cmd/git/fs.c
+++ b/sys/src/cmd/git/fs.c
@@ -75,7 +75,6 @@
 #define E2long	"path too long"
 #define Enodir	"not a directory"
 #define Erepo	"unable to read repo"
-#define Eobject "invalid object"
 #define Egreg	"wat"
 #define Ebadobj	"invalid object"
 
@@ -305,6 +304,9 @@
 		d->qid.path = qpath(c, i, o->id, Qauthor);
 		break;
 	default:
+		free(d->uid);
+		free(d->gid);
+		free(d->muid);
 		return -1;
 	}
 	return 0;
@@ -630,9 +632,9 @@
 			e = objwalk1(q, o->obj, o, c, name, Qobject, aux);
 		}else{
 			if(hparse(&h, name) == -1)
-				return Eobject;
+				return Ebadobj;
 			if((c->obj = readobject(h)) == nil)
-				return Eobject;
+				return Ebadobj;
 			if(c->obj->type == GBlob || c->obj->type == GTag){
 				c->mode = 0644;
 				q->type = 0;