bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

copy-file: Add missing free


From: Simon Reinhardt
Subject: copy-file: Add missing free
Date: Thu, 15 Oct 2015 17:16:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0

Dear list,

q?copy_file_preserving is leaking a block, each time it is called with a
bogus filename:

#include <config.h>
#include <copy-file.h>

int
main (void)
{
  qcopy_file_preserving ("/tmp/some_non_existent_file", "/tmp/vlevle");
}

will produce in valgrind:

==5703== 32,768 bytes in 1 blocks are definitely lost in loss record 1 of 1
==5703==    at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==5703==    by 0x402C0D: xmalloc (xmalloc.c:41)
==5703==    by 0x400EB4: qcopy_file_preserving (copy-file.c:61)
==5703==    by 0x400E88: main (copy-file.c:7)

Attached a fix that adds the missing call to free.

Thanks,
Simon

Attachment: 0001-copy-file-On-error-add-missing-call-to-free.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]