mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
Add memory error checks for strdup().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@376 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -529,7 +529,12 @@ SFTP_DIR *sftp_opendir(SFTP_SESSION *sftp, const char *path){
|
||||
}
|
||||
memset(dir,0,sizeof(*dir));
|
||||
dir->sftp=sftp;
|
||||
dir->name=strdup(path);
|
||||
dir->name = strdup(path);
|
||||
if (dir->name == NULL) {
|
||||
SAFE_FREE(dir);
|
||||
SAFE_FREE(file);
|
||||
return NULL;
|
||||
}
|
||||
dir->handle=file->handle;
|
||||
free(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user