diff options
-rw-r--r-- | source3/libsmb/libsmb_cache.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/libsmb/libsmb_cache.c b/source3/libsmb/libsmb_cache.c index e6033faf50..14577146fd 100644 --- a/source3/libsmb/libsmb_cache.c +++ b/source3/libsmb/libsmb_cache.c @@ -156,6 +156,17 @@ static SMBCSRV * smbc_get_cached_server(SMBCCTX * context, const char * server, continue; } + + SAFE_FREE(srv->share_name); + srv->share_name = SMB_STRDUP(share); + if (!srv->share_name) { + /* Out of memory. */ + cli_shutdown(&srv->server->cli); + context->callbacks.remove_cached_srv_fn(context, srv->server); + continue; + } + + return srv->server; } } |