Handle NULL and the same literal problem pointer in rpmProblemCompare()
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 26 Mar 2010 05:09:47 +0000 (07:09 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 26 Mar 2010 05:09:47 +0000 (07:09 +0200)
- if the pointers to compare are the same, the problem is the same
  (even if NULL for our purposes)
- if they're not the same and either is NULL then they're not the same

lib/rpmprob.c

index 1a5eef2..511a5b1 100644 (file)
@@ -200,6 +200,10 @@ static int cmpStr(const char *s1, const char *s2)
 
 int rpmProblemCompare(rpmProblem ap, rpmProblem bp)
 {
+    if (ap == bp)
+       return 0;
+    if (ap == NULL || bp == NULL)
+       return 1;
     if (ap->type != bp->type)
        return 1;
     if (ap->key != bp->key)