mirror of
https://github.com/containers/podman.git
synced 2026-10-07 18:52:24 -04:00
Fixes: #28531 Clean up temporary file for CreateImageFromSrc
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
This commit is contained in:
1 parent
3fa89a3c01
commit
64f9059d2e
1 file changed
+6
-1
@@ -204,7 +204,12 @@ func CreateImageFromSrc(w http.ResponseWriter, r *http.Request) {
|
||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed to create tempfile: %w", err))
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err := os.Remove(f.Name())
|
||||
if err != nil {
|
||||
logrus.Errorf("Failed to remove temporary file: %v.", err)
|
||||
}
|
||||
}()
|
||||
source = f.Name()
|
||||
if err := SaveFromBody(f, r); err != nil {
|
||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed to write temporary file: %w", err))
|
||||
|
||||
Reference in new issue
Block a user