| 1 |
#include "analyzer-decls.h" |
| 2 |
|
| 3 |
typedef void (*free_func)(void *opaque, void *address); |
| 4 |
|
| 5 |
typedef struct z_stream_s { |
| 6 |
struct internal_state *state; |
| 7 |
free_func zfree; |
| 8 |
void *opaque; |
| 9 |
} z_stream; |
| 10 |
|
| 11 |
struct internal_state { |
| 12 |
z_stream *strm; |
| 13 |
int status; |
| 14 |
unsigned char *pending_buf; |
| 15 |
unsigned char *window; |
| 16 |
unsigned short *prev; |
| 17 |
unsigned short *head; |
| 18 |
}; |
| 19 |
|
| 20 |
int deflateEnd(z_stream *strm) |
| 21 |
{ |
| 22 |
int status; |
| 23 |
|
| 24 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 25 |
|
| 26 |
if (strm == 0 || strm->state == 0) |
| 27 |
return (-2); |
| 28 |
|
| 29 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 30 |
|
| 31 |
status = strm->state->status; |
| 32 |
if (status != 42 && status != 113 && status != 666) { |
| 33 |
return (-2); |
| 34 |
} |
| 35 |
|
| 36 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 37 |
|
| 38 |
if (strm->state->pending_buf) |
| 39 |
(*(strm->zfree))(strm->opaque, (void *)(strm->state->pending_buf)); |
| 40 |
|
| 41 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 42 |
|
| 43 |
if (strm->state->head) |
| 44 |
(*(strm->zfree))(strm->opaque, (void *)(strm->state->head)); |
| 45 |
|
| 46 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 47 |
|
| 48 |
if (strm->state->prev) |
| 49 |
(*(strm->zfree))(strm->opaque, (void *)(strm->state->prev)); |
| 50 |
|
| 51 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 52 |
|
| 53 |
if (strm->state->window) |
| 54 |
(*(strm->zfree))(strm->opaque, (void *)(strm->state->window)); |
| 55 |
|
| 56 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 57 |
|
| 58 |
(*(strm->zfree))(strm->opaque, (void *)(strm->state)); |
| 59 |
strm->state = 0; |
| 60 |
|
| 61 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 62 |
|
| 63 |
return status == 113 ? (-3) : 0; |
| 64 |
} |