The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4975

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <[email protected]>
From 199b8f8cd646e941489ff8ead9b0baaab577b219 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Fri, 24 Aug 2018 17:30:35 -0400
Subject: [PATCH] lxd/images: Add missing cleanup code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <[email protected]>
---
 lxd/images.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lxd/images.go b/lxd/images.go
index 57a83a2fb2..1724b0b98b 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -645,8 +645,10 @@ func imagesPost(d *Daemon, r *http.Request) Response {
        err = decoder.Decode(&req)
        if err != nil {
                if r.Header.Get("Content-Type") == "application/json" {
+                       cleanup(builddir, post)
                        return BadRequest(err)
                }
+
                imageUpload = true
        }
 
@@ -663,9 +665,12 @@ func imagesPost(d *Daemon, r *http.Request) Response {
                        r.Body = post
                        response, err := 
ForwardedResponseIfContainerIsRemote(d, r, name)
                        if err != nil {
+                               cleanup(builddir, post)
                                return SmartError(err)
                        }
+
                        if response != nil {
+                               cleanup(builddir, post)
                                return response
                        }
                }
@@ -728,6 +733,7 @@ func imagesPost(d *Daemon, r *http.Request) Response {
 
        op, err := operationCreate(d.cluster, operationClassTask, 
db.OperationImageDownload, nil, nil, run, nil, nil)
        if err != nil {
+               cleanup(builddir, post)
                return InternalError(err)
        }
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to