mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
tools: Fix memory leaks.
* tools/gpgsplit.c (write_part): Free BLOB on error. -- GnuPG-bug-id: 5393 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
parent
7cbe29c4fb
commit
4c8be54cc4
@ -582,7 +582,10 @@ write_part (FILE *fpin, unsigned long pktlen,
|
|||||||
{
|
{
|
||||||
c = getc (fpin);
|
c = getc (fpin);
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
goto read_error;
|
{
|
||||||
|
xfree (blob);
|
||||||
|
goto read_error;
|
||||||
|
}
|
||||||
blob[i] = c;
|
blob[i] = c;
|
||||||
}
|
}
|
||||||
len = public_key_length (blob, pktlen);
|
len = public_key_length (blob, pktlen);
|
||||||
@ -594,18 +597,27 @@ write_part (FILE *fpin, unsigned long pktlen,
|
|||||||
if ( (hdr[0] & 0x40) )
|
if ( (hdr[0] & 0x40) )
|
||||||
{
|
{
|
||||||
if (write_new_header (fpout, pkttype, len))
|
if (write_new_header (fpout, pkttype, len))
|
||||||
goto write_error;
|
{
|
||||||
|
xfree (blob);
|
||||||
|
goto write_error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (write_old_header (fpout, pkttype, len))
|
if (write_old_header (fpout, pkttype, len))
|
||||||
goto write_error;
|
{
|
||||||
|
xfree (blob);
|
||||||
|
goto write_error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i < len; i++)
|
for (i=0; i < len; i++)
|
||||||
{
|
{
|
||||||
if ( putc (blob[i], fpout) == EOF )
|
if ( putc (blob[i], fpout) == EOF )
|
||||||
goto write_error;
|
{
|
||||||
|
xfree (blob);
|
||||||
|
goto write_error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ready;
|
goto ready;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user