talloc_strdup "dir" in wb_context_init
[samba.git] / nsswitch / libwbclient / wbc_async.c
index 6a572f4203c36ae31640e3595cada64c09a5c822..5f985f9d5acc7266a5af59841887551b75a543bc 100644 (file)
@@ -200,10 +200,14 @@ struct wb_context *wb_context_init(TALLOC_CTX *mem_ctx, const char* dir)
        result->is_priv = false;
 
        if (dir != NULL) {
-               result->dir = dir;
+               result->dir = talloc_strdup(result, dir);
        } else {
                result->dir = winbindd_socket_dir();
        }
+       if (result->dir == NULL) {
+               TALLOC_FREE(result);
+               return NULL;
+       }
        return result;
 }