Skip to content

Commit

Permalink
nss_wins: Add a stackframe to lookup_byname_backend()
Browse files Browse the repository at this point in the history
Autobuild-User: Volker Lendecke <[email protected]>
Autobuild-Date: Sun Jun  5 15:17:42 CEST 2011 on sn-devel-104
  • Loading branch information
vlendec committed Jun 5, 2011
1 parent 10f5fa8 commit 13ac91d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nsswitch/wins.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static void nss_wins_init(void)

static struct in_addr *lookup_byname_backend(const char *name, int *count)
{
TALLOC_CTX *frame = talloc_stackframe();
struct ip_service *address = NULL;
struct in_addr *ret = NULL;
int j;
Expand All @@ -73,16 +74,19 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
if (NT_STATUS_IS_OK(resolve_wins(name,0x00,&address,count))) {
if ( (ret = SMB_MALLOC_P(struct in_addr)) == NULL ) {
free( address );
TALLOC_FREE(frame);
return NULL;
}
if (address[0].ss.ss_family != AF_INET) {
free(address);
free(ret);
TALLOC_FREE(frame);
return NULL;
}
*ret = ((struct sockaddr_in *)(void *)&address[0].ss)
->sin_addr;
free( address );
TALLOC_FREE(frame);
return ret;
}

Expand All @@ -98,17 +102,17 @@ static struct in_addr *lookup_byname_backend(const char *name, int *count)
}
in_addr_to_sockaddr_storage(&ss, *bcast);
status = name_query(name, 0x00, True, True, &ss,
NULL, &pss, count, NULL);
talloc_tos(), &pss, count, NULL);
if (NT_STATUS_IS_OK(status) && (*count > 0)) {
if ((ret = SMB_MALLOC_P(struct in_addr)) == NULL) {
TALLOC_FREE(frame);
return NULL;
}
*ret = ((struct sockaddr_in *)pss)->sin_addr;
TALLOC_FREE(pss);
break;
}
}

TALLOC_FREE(frame);
return ret;
}

Expand Down

0 comments on commit 13ac91d

Please sign in to comment.