Skip to content

Commit

Permalink
Some fixes found by coverity for things used before a null check
Browse files Browse the repository at this point in the history
In the second case, we actually check the wrong variable.
  • Loading branch information
Mikachu committed Oct 28, 2014
1 parent 1491e19 commit 122e2a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions obrender/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,14 @@ RrImageSet* RrImageSetMergeSets(RrImageSet *b, RrImageSet *a)
gint n_original, n_resized, tmp;
GSList *it;

const gint max_resized = a->cache->max_resized_saved;
gint max_resized;

if (!a)
return b;
if (!b)
return a;
if (a == b)
return b;

/* the original and resized picture lists in an RrImageSet are kept ordered
as newest to oldest. we don't have timestamps for them, so we cannot
preserve this in the merged RrImageSet exactly. a decent approximation,
Expand All @@ -264,6 +263,8 @@ RrImageSet* RrImageSetMergeSets(RrImageSet *b, RrImageSet *a)

g_assert(b->cache == a->cache);

max_resized = a->cache->max_resized_saved;

a_i = b_i = merged_i = 0;
n_original = a->n_original + b->n_original;
original = g_new(RrImagePic*, n_original);
Expand Down
2 changes: 1 addition & 1 deletion obt/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ gboolean obt_xml_load_mem(ObtXmlInst *i,
xmlResetLastError();

i->doc = xmlParseMemory(data, len);
if (i) {
if (i->doc) {
i->root = xmlDocGetRootElement(i->doc);
if (!i->root) {
xmlFreeDoc(i->doc);
Expand Down

0 comments on commit 122e2a8

Please sign in to comment.