Fix resource leak of sockfd
This commit is contained in:
parent
cb1c8426ae
commit
29a047eea9
1 changed files with 2 additions and 0 deletions
|
@ -75,11 +75,13 @@ STATUS jsonbot_notify(TALLOC_CTX *mem_ctx, const char *prom, const char *code, c
|
||||||
if (sendto(sockfd, msgbuf_crypted, msglen, 0,
|
if (sendto(sockfd, msgbuf_crypted, msglen, 0,
|
||||||
(struct sockaddr *)&servaddr, sizeof(servaddr)) == -1) {
|
(struct sockaddr *)&servaddr, sizeof(servaddr)) == -1) {
|
||||||
DEBUG(0, "Failed to send UDP packet to %s:%d", conf->jsonbot_address, conf->jsonbot_port);
|
DEBUG(0, "Failed to send UDP packet to %s:%d", conf->jsonbot_address, conf->jsonbot_port);
|
||||||
|
close(sockfd);
|
||||||
return ST_GENERAL_FAILURE;
|
return ST_GENERAL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
talloc_free(outtext);
|
talloc_free(outtext);
|
||||||
|
|
||||||
|
close(sockfd);
|
||||||
return ST_OK;
|
return ST_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue