summaryrefslogtreecommitdiffstats
path: root/src/libs/jobmanager/lmi_job.c
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2014-06-30 15:14:53 +0200
committerMichal Minar <miminar@redhat.com>2014-07-01 10:06:27 +0200
commit599e084b9be3dabc2c24a3d3fe0c21e378481ecc (patch)
tree9f4a91033d47d2179012c2d7b91742d89183e63f /src/libs/jobmanager/lmi_job.c
parentccedb81c289ee52ee5db117c9b1082ef9b6532cb (diff)
downloadopenlmi-providers-599e084b9be3dabc2c24a3d3fe0c21e378481ecc.tar.gz
openlmi-providers-599e084b9be3dabc2c24a3d3fe0c21e378481ecc.tar.xz
openlmi-providers-599e084b9be3dabc2c24a3d3fe0c21e378481ecc.zip
jobmanager: fixed coverity issues
removed unused variables made sure that code works the same in (no)debug mode got rid of double frees
Diffstat (limited to 'src/libs/jobmanager/lmi_job.c')
-rw-r--r--src/libs/jobmanager/lmi_job.c24
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;