Skip to content

Commit

Permalink
[mDNS] - Fix of TICS DEREF-violation
Browse files Browse the repository at this point in the history
  • Loading branch information
jelledevleeschouwer committed Jun 19, 2015
1 parent 632aa7d commit deab7c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions modules/pico_mdns.c
Expand Up @@ -1305,15 +1305,14 @@ pico_mdns_my_records_probed( pico_mdns_rtree *records )
if ((record = node->keyValue)) {
/* Set the cache flush bit again */
PICO_MDNS_SET_MSB_BE(record->record->rsuffix->rclass);
if ((found = pico_tree_findKey(&MyRecords, record))) {
if ((found = pico_tree_findKey(&MyRecords, record))) {
if (IS_HOSTNAME_RECORD(found)) {
if (_hostname)
PICO_FREE(_hostname);
_hostname = pico_dns_qname_to_url(found->record->rname);
}
PICO_MDNS_SET_FLAG(found->flags, PICO_MDNS_RECORD_PROBED);
PICO_MDNS_CLR_FLAG(found->flags,
PICO_MDNS_RECORD_CURRENTLY_PROBING);
if (IS_HOSTNAME_RECORD(found)) {
if (_hostname) PICO_FREE(_hostname);

_hostname = pico_dns_qname_to_url(found->record->rname);
}
PICO_MDNS_CLR_FLAG(found->flags, PICO_MDNS_RECORD_CURRENTLY_PROBING);
} else
mdns_dbg("Could not find my corresponding record...\n");
}
Expand Down
2 changes: 1 addition & 1 deletion modules/pico_mdns.h
Expand Up @@ -30,7 +30,7 @@
/* Flag to check for when records are returned, to determine the hostname */
#define PICO_MDNS_RECORD_HOSTNAME 0x02u
#define IS_HOSTNAME_RECORD(x) \
((x) ? ((((x)->flags) & PICO_MDNS_RECORD_HOSTNAME) ? (1) : (0)) : (0))
(((x)->flags) & PICO_MDNS_RECORD_HOSTNAME) ? (1) : (0)

/* --- MDNS resource record --- */
struct pico_mdns_record
Expand Down

0 comments on commit deab7c3

Please sign in to comment.