Skip to contentSkip to conversation

add variable initializer

PATCH In review [email protected] 1 participant 2 messages Aug 22, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add variable initializer

The following patch fixes a bug found by Coverity:

It is possible to goto cleanup: before outfile is initialized. At cleanup: we try to close(outfile) if it is not NULL.

commit_api.c +1 -1
Index: src/commit_api.c
===================================================================
@@ -182,7 +182,7 @@ int semod_expand_sandbox(char *sandbox, 
         char *kernel_filename = NULL;
         sidtab_t sidtab;
         struct policy_file pf;
-        FILE *outfile;
+        FILE *outfile = NULL;
         if (policydb_init (&out, POLICY_KERN) == -1) {
                 write_error (error_buf, error_buf_size, "Out of memory!");
                 retval = -1;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw

Sorry, this patch was in libsemanage.

-serge

Quoted 21 lines · Quoting [email protected] ([email protected]):

The following patch fixes a bug found by Coverity:

It is possible to goto cleanup: before outfile is initialized. At cleanup: we try to close(outfile) if it is not NULL.

Index: src/commit_api.c
===================================================================

commit_api.c +1 -2
@@ -182,7 +182,7 @@ int semod_expand_sandbox(char *sandbox, 
         char *kernel_filename = NULL;
         sidtab_t sidtab;
         struct policy_file pf;
-        FILE *outfile;
+        FILE *outfile = NULL;
         if (policydb_init (&out, POLICY_KERN) == -1) {
                 write_error (error_buf, error_buf_size, "Out of memory!");
                 retval = -1;
 
--
Quoted 4 lines

This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.