mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
Fixed possible memory leak in lowercase function.
If user passed NULL pointer to lowercase() function, duplicated string "new" wasn't freed before return. Signed-off-by: Dmitry V. Krivenok <krivenok@orangesystem.ru> Signed-off-by: Andreas Schneider <mail@cynapses.org>
This commit is contained in:
committed by
Andreas Schneider
parent
2a10019f82
commit
18bce13617
@@ -1019,11 +1019,12 @@ static int alldigits(const char *s) {
|
||||
*/
|
||||
static char *lowercase(const char* str) {
|
||||
char *p = 0;
|
||||
char *new = strdup(str);
|
||||
char *new = NULL;
|
||||
|
||||
if((str == NULL) || (new == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if(str == NULL) return NULL;
|
||||
|
||||
new = strdup(str);
|
||||
if(new == NULL) return NULL;
|
||||
|
||||
for (p = new; *p; p++) {
|
||||
*p = tolower(*p);
|
||||
|
||||
Reference in New Issue
Block a user