Skip to content

Commit

Permalink
Fix segfault after statsd_init fails (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
szpajder authored and Roman Shterenzon committed Jul 23, 2017
1 parent 4b326c0 commit 93c9df3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions statsd-client.c
Expand Up @@ -20,6 +20,8 @@ statsd_link *statsd_init_with_namespace(const char *host, int port, const char *
size_t len = strlen(ns_);

statsd_link *temp = statsd_init(host, port);
if(!temp)
return NULL;

if ( (temp->ns = malloc(len + 2)) == NULL ) {
perror("malloc");
Expand Down

0 comments on commit 93c9df3

Please sign in to comment.