Skip to content

Commit

Permalink
Fix a memory leak
Browse files Browse the repository at this point in the history
Reported by AddressSanitizer of GCC:
Direct leak of 970518528 byte(s) in 947772 object(s) allocated from:
    #0 0x7f505036363f in operator new[](unsigned long) (/usr/lib/libasan.so.1+0x5863f)
    #1 0x65676f in agg::agg_graphics::agg_gradient_pen(int, double, double, double, double, double, double, double, unsigned char*, double*, int) ../src/agg/agg_graphics.cpp:1306
    #2 0x5fe247 in rebdrw_gradient_pen ../src/os/host-draw-api-agg.cpp:184
    #3 0x5f8834 in RXD_Draw ../src/os/host-draw.c:294
    #4 0x45cd8e in Do_Commands ../src/core/f-extension.c:579
    #5 0x40680d in RL_Do_Commands ../src/core/a-lib.c:376
    #6 0x603d21 in rebdrw_gob_draw ../src/os/host-draw-api-agg.cpp:567
    #7 0x60c732 in process_gobs ../src/os/linux/host-compositor.c:520
    #8 0x60cb55 in process_gobs ../src/os/linux/host-compositor.c:559
    #9 0x60cb55 in process_gobs ../src/os/linux/host-compositor.c:559
    #10 0x60cb55 in process_gobs ../src/os/linux/host-compositor.c:559
    #11 0x60cb55 in process_gobs ../src/os/linux/host-compositor.c:559
    #12 0x60f753 in rebcmp_compose ../src/os/linux/host-compositor.c:685
    #13 0x5e8299 in Draw_Window ../src/os/host-view.c:225
    #14 0x5e8682 in Show_Gob ../src/os/host-view.c:288
    #15 0x5e8b58 in RXD_Graphics ../src/os/host-view.c:346
    #16 0x45bf75 in Do_Command ../src/core/f-extension.c:456
    #17 0x41395b in Do_Next ../src/core/c-do.c:886
    #18 0x414b73 in Do_Blk ../src/core/c-do.c:1016
    #19 0x42ea5c in Do_Function ../src/core/c-function.c:415
    #20 0x41395b in Do_Next ../src/core/c-do.c:886
    #21 0x414b73 in Do_Blk ../src/core/c-do.c:1016
    #22 0x42ea5c in Do_Function ../src/core/c-function.c:415
    #23 0x41395b in Do_Next ../src/core/c-do.c:886
    #24 0x414b73 in Do_Blk ../src/core/c-do.c:1016
    #25 0x4883d6 in N_if ../src/core/n-control.c:632
    #26 0x42dd9c in Do_Native ../src/core/c-function.c:289
    #27 0x41395b in Do_Next ../src/core/c-do.c:886
    #28 0x414b73 in Do_Blk ../src/core/c-do.c:1016
    #29 0x496d2f in N_forever ../src/core/n-loop.c:532
  • Loading branch information
zsx committed Oct 15, 2014
1 parent 37bf305 commit 1caacd6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/agg/agg_graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,8 @@ Reb_Print(
default:
return;
}
m_color_profile = new rgba8 [256];
if (m_color_profile == NULL)
m_color_profile = new rgba8 [256];
unsigned num_pnt = colors[0] - 1;

unsigned o = 3, of = 2, j = 5;
Expand Down

0 comments on commit 1caacd6

Please sign in to comment.