mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 05:01:13 +00:00
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:
parent
abc3364a7b
commit
1bc986423d
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue