Commits

evhan committed db48c1d

avoid premature free() on reference-target oid result

Comments (0)

Files changed (1)

 
 (define (reference-target ref)
   ;; We have to dig out the intermediate reference in order to free it.
-  (let* ((ref*   (git-reference-resolve (reference->pointer ref)))
-         (target (git-reference-target ref*)))
+  (let* ((ref* (git-reference-resolve (reference->pointer ref)))
+         (oid* (git-oid-cpy (git-reference-target ref*))))
     (git-reference-free ref*)
-    (pointer->oid (git-oid-cpy target))))
+    (pointer->oid oid*)))
 
 (define (reference repo name)
   (pointer->reference (git-reference-lookup (repository->pointer repo) name)))