pki: Fix minor resource leak on failure to read the private key in --req 5.1.2rc2
authorTobias Brunner <tobias@strongswan.org>
Tue, 18 Feb 2014 12:48:13 +0000 (13:48 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 18 Feb 2014 15:46:25 +0000 (16:46 +0100)
src/pki/commands/req.c

index 6460959..5b2c128 100644 (file)
@@ -122,7 +122,8 @@ static int req()
                if (!chunk_from_fd(0, &chunk))
                {
                        fprintf(stderr, "reading private key failed: %s\n", strerror(errno));
-                       return 1;
+                       error = "";
+                       goto end;
                }
                private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, type,
                                                                         BUILD_BLOB, chunk, BUILD_END);