diff options
| author | Thomas Schmucker <ts@its1.de> | 2020-09-04 09:16:44 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2020-09-04 09:16:44 +0200 |
| commit | ace33ff2c18c732e7ac30c49d95f7c35e06d7cee (patch) | |
| tree | c5988861f6971618455af7a7b5891e5a3ef68eec /queue.c | |
| parent | f484584a4a9fa62a06a00a58864f0756665da630 (diff) | |
| download | data-structures-ace33ff2c18c732e7ac30c49d95f7c35e06d7cee.tar.gz data-structures-ace33ff2c18c732e7ac30c49d95f7c35e06d7cee.tar.bz2 data-structures-ace33ff2c18c732e7ac30c49d95f7c35e06d7cee.zip | |
fix: Prüfe, ob 'data' wirklich dereferenziert werden kann
Diffstat (limited to 'queue.c')
| -rw-r--r-- | queue.c | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -47,7 +47,10 @@ queue_get(struct queue *queue, T *data) | |||
| 47 | { | 47 | { |
| 48 | if ( queue->head != NULL ) { | 48 | if ( queue->head != NULL ) { |
| 49 | struct queue_item *next = queue->head->next; | 49 | struct queue_item *next = queue->head->next; |
| 50 | *data = queue->head->data; | 50 | |
| 51 | if ( data != NULL ) { | ||
| 52 | *data = queue->head->data; | ||
| 53 | } | ||
| 51 | free(queue->head); | 54 | free(queue->head); |
| 52 | queue->head = next; | 55 | queue->head = next; |
| 53 | 56 | ||
