• Philip Withnall's avatar
    agent: Fix a leak in nice_output_stream_write() with a NULL cancellable · a5b8578d
    Philip Withnall authored
    If @cancellable is NULL in a call to nice_output_stream_write(), the
    WriteData struct is created with a reference count of 4, but only two
    operations are scheduled which will result in its reference count being
    decremented. The third operation is only scheduled if @cancellable is
    non-NULL (and the final reference is dropped unconditionally at the end
    of the function).
    
    Fix this by properly implementing reference counting for WriteData,
    rather than hard-coding the expected number of references in a fragile
    and unmaintainable way.
    a5b8578d
outputstream.c 19 KB