aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmicli/qmicli-dms.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-04-19 21:24:28 +0200
committerAleksander Morgado <aleksander@aleksander.es>2017-04-19 21:24:28 +0200
commitaa364e3d8594a6496cb29a5ac1b81b9bf22dd73b (patch)
treec4f513aa951a590235c26f77aa9a736f546e3b60 /src/qmicli/qmicli-dms.c
parent907cc6a96b43bacb20e36f7ec6597a6210a00367 (diff)
downloadexternal_libqmi-aa364e3d8594a6496cb29a5ac1b81b9bf22dd73b.zip
external_libqmi-aa364e3d8594a6496cb29a5ac1b81b9bf22dd73b.tar.gz
external_libqmi-aa364e3d8594a6496cb29a5ac1b81b9bf22dd73b.tar.bz2
qmicli,dms: fix logic getting stored image result
The GetStoredImageResult must exist before getting into the array item loop, so that we fill the contents of the struct when we find the images (modem and pri) we were looking for. This also fixes the build when -Werror=maybe-uninitialized is used: /var/lib/jenkins/workspace/libqmi/master-without-mbim/source/src/qmicli/qmicli-dms.c:2800:5: error: ‘result’ may be used uninitialized in this function [-Werror=maybe-uninitialized] g_task_return_pointer (task, result, (GDestroyNotify)get_stored_image_result_free); ^
Diffstat (limited to 'src/qmicli/qmicli-dms.c')
-rw-r--r--src/qmicli/qmicli-dms.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c
index b249752..bc1fde5 100644
--- a/src/qmicli/qmicli-dms.c
+++ b/src/qmicli/qmicli-dms.c
@@ -2741,6 +2741,9 @@ get_stored_image_list_stored_images_ready (QmiClientDms *client,
operation_ctx = g_task_get_task_data (task);
+ /* A single result struct is used for all iterations */
+ result = g_slice_new0 (GetStoredImageResult);
+
for (i = 0; i < array->len; i++) {
QmiMessageDmsListStoredImagesOutputListImageSublistSublistElement *subimage;
QmiMessageDmsListStoredImagesOutputListImage *image;
@@ -2784,8 +2787,6 @@ get_stored_image_list_stored_images_ready (QmiClientDms *client,
subimage->build_id);
g_free (unique_id_str);
- /* Build result */
- result = g_slice_new0 (GetStoredImageResult);
if (image->type == QMI_DMS_FIRMWARE_IMAGE_TYPE_MODEM) {
result->modem_unique_id = subimage->unique_id ? g_array_ref (subimage->unique_id) : NULL;
result->modem_build_id = g_strdup (subimage->build_id);