From 7a9b28199684f10d0cdb0f103911ad532f86e803 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 6 Sep 2014 16:51:39 -0400 Subject: [PATCH] Fix return code of IMPORT. When invalid XML (no _name attribute) is detected. Also fix a potential memory leak. --- src/commands.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands.c b/src/commands.c index 23a66f51..df7a6c61 100644 --- a/src/commands.c +++ b/src/commands.c @@ -2880,7 +2880,7 @@ do_import (struct client_s *client, const char *root_element, if (!a) { strv_free (path); - rc = GPG_ERR_ENOMEM; + rc = GPG_ERR_INV_VALUE; goto fail; } @@ -3046,7 +3046,11 @@ import_command (assuan_context_t ctx, char *line) rc = assuan_inquire (ctx, "DATA", &result, &len, 0); if (rc) - return send_error (ctx, rc); + { + xfree (client->import_root); + client->import_root = NULL; + return send_error (ctx, rc); + } rc = do_import (client, client->import_root, result); xfree (client->import_root); -- 2.11.4.GIT