- in testcode, free async ids, initialise array, and check for null
pointer during test of the test. And use exit for return to note
irregular program stop.
+ - Free memory leak in config strlist append.
+ - make sure nsec3 comparison salt is initialized.
11 September 2018: Wouter
- Fixed unused return value warnings in contrib/fastrpz.patch for
{
char buf[1024], nopt[64];
size_t len = sizeof(buf);
+ if(!opt) return 0;
if(opt && opt[strlen(opt)-1] == ':' && strlen(opt)<sizeof(nopt)) {
memmove(nopt, opt, strlen(opt));
nopt[strlen(opt)-1] = 0;
int cfg_strlist_append(struct config_strlist_head* list, char* item)
{
struct config_strlist *s;
- if(!item || !list)
+ if(!item || !list) {
+ free(item);
return 0;
+ }
s = (struct config_strlist*)calloc(1, sizeof(struct config_strlist));
- if(!s)
+ if(!s) {
+ free(item);
return 0;
+ }
s->str = item;
s->next = NULL;
if(list->last)
* @param list: list head. zeroed at start.
* @param item: new item. malloced by caller. if NULL the insertion fails.
* @return true on success.
+ * on fail the item is free()ed.
*/
int cfg_strlist_append(struct config_strlist_head* list, char* item);
}
(void)nsec3_get_salt(h1->nsec3, h1->rr, &s1, &s1len);
(void)nsec3_get_salt(h2->nsec3, h2->rr, &s2, &s2len);
+ if(s1len == 0 && s2len == 0)
+ return 0;
+ if(!s1) return -1;
+ if(!s2) return 1;
if(s1len != s2len) {
if(s1len < s2len)
return -1;
size_t i_rs;
int i_rr;
struct ub_packed_rrset_key* s;
- struct nsec3_cached_hash* hash;
+ struct nsec3_cached_hash* hash = NULL;
int r;
/* this loop skips other-zone and unknown NSEC3s, also non-NSEC3 RRs */
if(r == 0) {
log_err("nsec3: malloc failure");
break; /* alloc failure */
- } else if(r < 0)
+ } else if(r != 1)
continue; /* malformed NSEC3 */
else if(nsec3_hash_matches_owner(flt, hash, s)) {
*rrset = s; /* rrset with this name */
size_t i_rs;
int i_rr;
struct ub_packed_rrset_key* s;
- struct nsec3_cached_hash* hash;
+ struct nsec3_cached_hash* hash = NULL;
int r;
/* this loop skips other-zone and unknown NSEC3s, also non-NSEC3 RRs */
if(r == 0) {
log_err("nsec3: malloc failure");
break; /* alloc failure */
- } else if(r < 0)
+ } else if(r != 1)
continue; /* malformed NSEC3 */
else if(nsec3_covers(flt->zone, hash, s, i_rr,
env->scratch_buffer)) {