Updated freerdp_settings_set_string
Allow NULL argument with length, creates an empty string
This commit is contained in:
parent
0577d7a0c3
commit
94685c9482
@ -17,6 +17,12 @@ static BOOL update_string(char** current, const char* next, size_t next_len, BOO
|
||||
free(*current);
|
||||
}
|
||||
|
||||
if (!next && (next_len > 0))
|
||||
{
|
||||
*current = calloc(next_len, 1);
|
||||
return (*current != NULL);
|
||||
}
|
||||
|
||||
*current = (next ? strndup(next, next_len) : NULL);
|
||||
return !next || (*current != NULL);
|
||||
}
|
||||
|
@ -428,6 +428,12 @@ try:
|
||||
f.write('\t\tfree(*current);\n')
|
||||
f.write('\t}\n')
|
||||
f.write('\n')
|
||||
f.write('\tif (!next && (next_len > 0))\n')
|
||||
f.write('\t{\n')
|
||||
f.write('\t\t*current = calloc(next_len, 1);\n')
|
||||
f.write('\t\treturn (*current != NULL);\n')
|
||||
f.write('\t}\n')
|
||||
f.write('\n')
|
||||
f.write('\t*current = (next ? strndup(next, next_len) : NULL);\n')
|
||||
f.write('\treturn !next || (*current != NULL);\n')
|
||||
f.write('}\n\n')
|
||||
|
Loading…
Reference in New Issue
Block a user