deamon-helper: ensure helper_complete() never returns NULL on success

The in_buffer is initialized with a NULL buffer. If we never receive and
data, the buffer might still be NULL.

Maybe it actually can never happen, but it's not clear that this is
always the case. To be sure, ensure we don't return a NULL buffer on
success.
This commit is contained in:
Thomas Haller
2024-07-05 11:40:34 +02:00
committed by Fernando Fernandez Mancera
parent 9f6ecbae69
commit 47283b7c76

View File

@@ -5096,7 +5096,9 @@ helper_complete(HelperInfo *info, GError *error)
} }
nm_clear_g_cancellable_disconnect(g_task_get_cancellable(info->task), &info->cancellable_id); nm_clear_g_cancellable_disconnect(g_task_get_cancellable(info->task), &info->cancellable_id);
g_task_return_pointer(info->task, nm_str_buf_finalize(&info->in_buffer, NULL), g_free); g_task_return_pointer(info->task,
nm_str_buf_finalize(&info->in_buffer, NULL) ?: g_new0(char, 1),
g_free);
helper_info_free(info); helper_info_free(info);
} }