Code review comment for lp:~3v1n0/bamf/mime-types-fix-crash-1058260

Revision history for this message
Michal Hruby (mhr3) wrote :

66 + if (!new_mimes)
67 {
68 gchar *empty[] = {NULL};
69 -
70 - mimes = g_strdupv (empty);
71 + mimes = empty;
72 }

Ouch, looks pretty dangerous, you're taking address of a temporary that's not valid outside of that block.

181 + for (it = mimes; *it; it++)
182 + {
183 + g_variant_builder_add (&b, "s", *it);
184 + }

Why so complicated? How about g_variant_new_strv()? (or perhaps `g_variant_new("(@as)", g_variant_new_strv(...));`)

review: Needs Fixing

« Back to merge proposal