Skip to content

Commit

Permalink
dxf2dwg: fix leak on wrong file
Browse files Browse the repository at this point in the history
eg. programs/dxf2dwg -y -v3 example_2000.dwg

ERROR: This is a DWG, not a DXF file: ../td/example_2000.dwg

READ ERROR 0x800 ../td/example_2000.dwg

=================================================================
==1678362==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x7f55fa6e7667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    #1 0x402eba in suffix ../../programs/suffix.inc:53
    #2 0x4043d7 in main ../../programs/dxf2dwg.c:299
  • Loading branch information
rurban committed Dec 18, 2020
1 parent fd79003 commit 496702e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions programs/dxf2dwg.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ main (int argc, char *argv[])
if (error >= DWG_ERR_CRITICAL)
{
fprintf (stderr, "READ ERROR 0x%x %s\n", error, filename_in);
if (need_free)
free (filename_out);
continue;
}

Expand Down

0 comments on commit 496702e

Please # to comment.