Commit e61d9ea0 e61d9ea0a63b7a13ac02cfdd332cdaa5ee0ef1ad by Sergey Poznyakoff

(_get_address_part): Bugfix: assign to *data only if ret is not null.

1 parent 98011e85
...@@ -31,7 +31,7 @@ static int ...@@ -31,7 +31,7 @@ static int
31 _get_address_part (void *item, void *data) 31 _get_address_part (void *item, void *data)
32 { 32 {
33 sieve_runtime_tag_t *t = item; 33 sieve_runtime_tag_t *t = item;
34 address_aget_t ret; 34 address_aget_t ret = NULL;
35 35
36 if (strcmp (t->tag, "all") == 0) 36 if (strcmp (t->tag, "all") == 0)
37 ret = address_aget_email; 37 ret = address_aget_email;
...@@ -39,8 +39,12 @@ _get_address_part (void *item, void *data) ...@@ -39,8 +39,12 @@ _get_address_part (void *item, void *data)
39 ret = address_aget_domain; 39 ret = address_aget_domain;
40 else if (strcmp (t->tag, "localpart") == 0) 40 else if (strcmp (t->tag, "localpart") == 0)
41 ret = address_aget_local_part; 41 ret = address_aget_local_part;
42 *(address_aget_t*)data = ret; 42 if (ret)
43 return ret != NULL; 43 {
44 *(address_aget_t*)data = ret;
45 return 1; /* break the loop */
46 }
47 return 0; /* continue */
44 } 48 }
45 49
46 address_aget_t 50 address_aget_t
......