diff options
Diffstat (limited to 'src/libs/jobmanager/lmi_job.c')
-rw-r--r-- | src/libs/jobmanager/lmi_job.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/libs/jobmanager/lmi_job.c b/src/libs/jobmanager/lmi_job.c index 41a91d4..464bd41 100644 --- a/src/libs/jobmanager/lmi_job.c +++ b/src/libs/jobmanager/lmi_job.c @@ -1844,13 +1844,15 @@ gchar **lmi_job_get_in_param_keys(const LmiJob *job) if (job->priv->in_parameters) size = g_hash_table_size(job->priv->in_parameters); res = g_new(gchar *, size + 1); - if (res && size > 1) { - g_hash_table_iter_init(&hi, job->priv->in_parameters); - while (g_hash_table_iter_next(&hi, &key, NULL)) { - res[index++] = g_strdup((const char *) key); + if (res != NULL) { + if (size > 1) { + g_hash_table_iter_init(&hi, job->priv->in_parameters); + while (g_hash_table_iter_next(&hi, &key, NULL)) { + res[index++] = g_strdup((const char *) key); + } } + res[index] = NULL; } - res[index] = NULL; PRIV_CRITICAL_CRITICAL_END(job->priv); return res; @@ -1923,13 +1925,15 @@ gchar **lmi_job_get_out_param_keys(const LmiJob *job) if (job->priv->out_parameters) size = g_hash_table_size(job->priv->out_parameters); res = g_new(gchar *, size + 1); - if (res && size > 1) { - g_hash_table_iter_init(&hi, job->priv->out_parameters); - while (g_hash_table_iter_next(&hi, &key, NULL)) { - res[index++] = g_strdup((const char *) key); + if (res != NULL) { + if (size > 1) { + g_hash_table_iter_init(&hi, job->priv->out_parameters); + while (g_hash_table_iter_next(&hi, &key, NULL)) { + res[index++] = g_strdup((const char *) key); + } } + res[index] = NULL; } - res[index] = NULL; PRIV_CRITICAL_CRITICAL_END(job->priv); return res; |