Skip to contentSkip to conversation

free conary on error path in get_default_context()

PATCH New [email protected] 1 participant 1 message Aug 10, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 free conary on error path in get_default_context()

This patch fixes a trivial bug found in get_context_list.c by Coverity:

When strdup(conary) fails, conary is not freed.

get_context_list.c +1 -1
Index: src/get_context_list.c
===================================================================
@@ -60,9 +60,9 @@ int get_default_context(const char* user
 	    return -1;
 
     *newcon = strdup(conary[0]);
+    freeconary(conary);
     if (!(*newcon))
 	    return -1;
-    freeconary(conary);
     return 0;
 }
 

--
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.