[PATCH] bearer-qmi: replace g_new + memcpy with g_memdup
Ben Chan
benchan at chromium.org
Mon Jul 10 18:20:57 UTC 2017
---
src/mm-bearer-qmi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c
index 4d532274..c687db60 100644
--- a/src/mm-bearer-qmi.c
+++ b/src/mm-bearer-qmi.c
@@ -151,7 +151,6 @@ reload_stats_context_step (GTask *task)
{
MMBearerQmi *self;
ReloadStatsContext *ctx;
- ReloadStatsResult *stats;
self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task);
@@ -185,9 +184,9 @@ reload_stats_context_step (GTask *task)
ctx->step++;
/* Fall through */
case RELOAD_STATS_CONTEXT_STEP_LAST:
- stats = g_new (ReloadStatsResult, 1);
- memcpy (stats, &ctx->stats, sizeof (ctx->stats));
- g_task_return_pointer (task, stats, g_free);
+ g_task_return_pointer (task,
+ g_memdup (&ctx->stats, sizeof (ctx->stats)),
+ g_free);
g_object_unref (task);
return;
}
--
2.13.2.725.g09c95d1e9-goog
More information about the ModemManager-devel
mailing list