Fixing prevent defects in libprivilege-control:
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Tue, 2 Jul 2013 11:55:11 +0000 (13:55 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Tue, 9 Jul 2013 11:59:18 +0000 (11:59 +0000)
* 63125; Minor; Unchecked return value; In function app_uninstall_remove_early_rules
  in src/privilege-control.c (defect changed to false positive)
* 63145; Critical; Dereference after null check; In function main
  in rule_loader/rule_loader.c
* 63146; Critical; Dereference after null check; In function
  app_uninstall_remove_early_rules in src/privilege-control.c

[Issue#]        N/A
[Bug/Feature]   There are 3 prevent issues to solve.
[Cause]         N/A
[Solution]      N/A
[Verification]  Running libprivilege tests. All should pass.

Change-Id: I5298a40ebef24286fec1149b48cac33e32753c00

rule_loader/rule_loader.c
src/privilege-control.c

index eaf9514..ba8c39e 100644 (file)
@@ -64,6 +64,7 @@ error:
         free(installed_app_list);
     }
 
-    fclose(log_file);
+    if (log_file)
+        fclose(log_file);
     return ret;
 }
index e99ccbf..25483f2 100644 (file)
@@ -1619,7 +1619,9 @@ static int app_uninstall_remove_early_rules(const char *app_id)
 
 out:
 
-       sem_post(sem);
+       if (sem)
+               sem_post(sem);
+       // Should we check unlink?
        sem_unlink(PRIVILEGE_CONTROL_UNINSTALL_SEM);
        return ret;
 }