sd-json: make sure SD_JSON_BUILD_STRING_UNDERSCORIFY() can deal with NULL strings
SD_JSON_BUILD_STRING() and everything else can deal with it, make sure SD_JSON_BUILD_STRING_UNDERSCORIFY() can too.
This commit is contained in:
@@ -3595,7 +3595,7 @@ _public_ int sd_json_buildv(sd_json_variant **ret, va_list ap) {
|
||||
if (current->n_suppress == 0) {
|
||||
_cleanup_free_ char *c = NULL;
|
||||
|
||||
if (command == _JSON_BUILD_STRING_UNDERSCORIFY) {
|
||||
if (command == _JSON_BUILD_STRING_UNDERSCORIFY && p) {
|
||||
c = strdup(p);
|
||||
if (!c) {
|
||||
r = -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user