istream.c (dovecot-2.3.16) | : | istream.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 60 | skipping to change at line 60 | |||
void i_stream_unref(struct istream **stream) | void i_stream_unref(struct istream **stream) | |||
{ | { | |||
struct istream_private *_stream; | struct istream_private *_stream; | |||
if (*stream == NULL) | if (*stream == NULL) | |||
return; | return; | |||
_stream = (*stream)->real_stream; | _stream = (*stream)->real_stream; | |||
if (!io_stream_unref(&_stream->iostream)) { | if (_stream->iostream.refcount > 1) { | |||
str_free(&_stream->line_str); | if (!io_stream_unref(&_stream->iostream)) | |||
i_unreached(); | ||||
} else { | ||||
/* The snapshot may contain pointers to the parent istreams. | ||||
Free it before io_stream_unref() frees the parents. */ | ||||
i_stream_snapshot_free(&_stream->prev_snapshot); | i_stream_snapshot_free(&_stream->prev_snapshot); | |||
if (io_stream_unref(&_stream->iostream)) | ||||
i_unreached(); | ||||
str_free(&_stream->line_str); | ||||
i_stream_unref(&_stream->parent); | i_stream_unref(&_stream->parent); | |||
io_stream_free(&_stream->iostream); | io_stream_free(&_stream->iostream); | |||
} | } | |||
*stream = NULL; | *stream = NULL; | |||
} | } | |||
#undef i_stream_add_destroy_callback | #undef i_stream_add_destroy_callback | |||
void i_stream_add_destroy_callback(struct istream *stream, | void i_stream_add_destroy_callback(struct istream *stream, | |||
istream_callback_t *callback, void *context) | istream_callback_t *callback, void *context) | |||
{ | { | |||
skipping to change at line 246 | skipping to change at line 254 | |||
void i_stream_snapshot_free(struct istream_snapshot **_snapshot) | void i_stream_snapshot_free(struct istream_snapshot **_snapshot) | |||
{ | { | |||
struct istream_snapshot *snapshot = *_snapshot; | struct istream_snapshot *snapshot = *_snapshot; | |||
if (*_snapshot == NULL) | if (*_snapshot == NULL) | |||
return; | return; | |||
*_snapshot = NULL; | *_snapshot = NULL; | |||
i_stream_snapshot_free(&snapshot->prev_snapshot); | i_stream_snapshot_free(&snapshot->prev_snapshot); | |||
if (snapshot->old_memarea != NULL) | if (snapshot->free != NULL) | |||
memarea_unref(&snapshot->old_memarea); | snapshot->free(snapshot); | |||
i_free(snapshot); | else { | |||
if (snapshot->old_memarea != NULL) | ||||
memarea_unref(&snapshot->old_memarea); | ||||
i_free(snapshot); | ||||
} | ||||
} | } | |||
static struct istream_snapshot * | static struct istream_snapshot * | |||
i_stream_noop_snapshot(struct istream_private *stream ATTR_UNUSED, | i_stream_noop_snapshot(struct istream_private *stream ATTR_UNUSED, | |||
struct istream_snapshot *prev_snapshot) | struct istream_snapshot *prev_snapshot) | |||
{ | { | |||
return prev_snapshot; | return prev_snapshot; | |||
} | } | |||
ssize_t i_stream_read(struct istream *stream) | ssize_t i_stream_read(struct istream *stream) | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 17 lines changed or added |