aboutsummaryrefslogtreecommitdiff
path: root/queue.c
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-09-04 09:16:44 +0200
committerThomas Schmucker <ts@its1.de>2020-09-04 09:16:44 +0200
commitace33ff2c18c732e7ac30c49d95f7c35e06d7cee (patch)
treec5988861f6971618455af7a7b5891e5a3ef68eec /queue.c
parentf484584a4a9fa62a06a00a58864f0756665da630 (diff)
downloaddata-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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/queue.c b/queue.c
index e26acbb..2fb9c72 100644
--- a/queue.c
+++ b/queue.c
@@ -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