mirror of
1
Fork 0

fix: rpm sign resource leak (#4878)

Fixed the resource leak  in #4780.

Related:  [go-gitea/gitea#31794](https://github.com/go-gitea/gitea/pull/31794)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4878
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Exploding Dragon <explodingfkl@gmail.com>
Co-committed-by: Exploding Dragon <explodingfkl@gmail.com>
This commit is contained in:
Exploding Dragon 2024-08-08 07:28:09 +00:00 committed by Earl Warren
parent abc3364a7b
commit 1bc986423d
1 changed files with 3 additions and 1 deletions

View File

@ -139,12 +139,14 @@ func UploadPackageFile(ctx *context.Context) {
apiError(ctx, http.StatusInternalServerError, err)
return
}
buf, err = rpm_service.NewSignedRPMBuffer(buf, pri)
signedBuf, err := rpm_service.NewSignedRPMBuffer(buf, pri)
if err != nil {
// Not in rpm format, parsing failed.
apiError(ctx, http.StatusBadRequest, err)
return
}
defer signedBuf.Close()
buf = signedBuf
}
pck, err := rpm_module.ParsePackage(buf)