chiark / gitweb /
Import gnupg2_2.1.18-6.debian.tar.bz2
[gnupg2.git] / patches / 0012-tools-Fix-memory-leak.patch
1 From: Justus Winter <justus@g10code.com>
2 Date: Mon, 23 Jan 2017 11:52:30 +0100
3 Subject: tools: Fix memory leak.
4
5 * tools/gpgconf-comp.c (change_options_file): Fix leak.
6 --
7 Previously, 'src_filename' and 'orig_filename' leaked if creating the
8 backup file failed.
9
10 Signed-off-by: Justus Winter <justus@g10code.com>
11 (cherry picked from commit 5b28f025085b386e0ec49535d4cd3f875a414eb0)
12 ---
13  tools/gpgconf-comp.c | 2 ++
14  1 file changed, 2 insertions(+)
15
16 diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
17 index a25b5136e..85eb80ab5 100644
18 --- a/tools/gpgconf-comp.c
19 +++ b/tools/gpgconf-comp.c
20 @@ -2641,6 +2641,8 @@ change_options_file (gc_component_t component, gc_backend_t backend,
21    if (res < 0 && errno != ENOENT)
22      {
23        xfree (dest_filename);
24 +      xfree (src_filename);
25 +      xfree (orig_filename);
26        return -1;
27      }
28    if (res < 0)