stream: ensure stream_stop resets the FILE pointer if STREAM_TYPE_FILE
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
* Commentary:
|
* Commentary:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -95,8 +96,11 @@ void stream_stop(stream_t *stream)
|
|||||||
case STREAM_TYPE_STRING:
|
case STREAM_TYPE_STRING:
|
||||||
free(stream->string.data);
|
free(stream->string.data);
|
||||||
break;
|
break;
|
||||||
case STREAM_TYPE_PIPE:
|
|
||||||
case STREAM_TYPE_FILE:
|
case STREAM_TYPE_FILE:
|
||||||
|
// ensure we reset the FILE pointer to the start
|
||||||
|
fseek(stream->pipe.file, 0, SEEK_SET);
|
||||||
|
// fallthrough
|
||||||
|
case STREAM_TYPE_PIPE:
|
||||||
// Must cleanup vector
|
// Must cleanup vector
|
||||||
vec_free(&stream->pipe.cache);
|
vec_free(&stream->pipe.cache);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user