From 4f5ef4dfc490709a0bf8775458cc2eef35cc75fb Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 1 Dec 2017 14:30:23 +0100 Subject: [PATCH] perl plugin: Fix exporting notification meta data. Previously, the while loop ensured that meta was NULL, causing the for loop to never been executed. This introduces a new temporary variable to avoid changing meta before the for loop. CID: 37960 --- src/perl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/perl.c b/src/perl.c index f58e02ab..dcb553a6 100644 --- a/src/perl.c +++ b/src/perl.c @@ -496,7 +496,8 @@ static int av2data_set(pTHX_ AV *array, char *name, data_set_t *ds) { * meta => [ { name => , value => }, ... ] * } */ -static int av2notification_meta(pTHX_ AV *array, notification_meta_t **ret_meta) { +static int av2notification_meta(pTHX_ AV *array, + notification_meta_t **ret_meta) { notification_meta_t *tail = NULL; int len = av_len(array); @@ -715,10 +716,8 @@ static int value_list2hv(pTHX_ value_list_t *vl, data_set_t *ds, HV *hash) { static int notification_meta2av(pTHX_ notification_meta_t *meta, AV *array) { int meta_num = 0; - - while (meta) { + for (notification_meta_t *m = meta; m != NULL; m = m->next) { ++meta_num; - meta = meta->next; } av_extend(array, meta_num); -- 2.11.0