chiark / gitweb /
selinux: fix potential double free crash in child process
[elogind.git] / src / shared / label.c
index b6af38d82d39a0940c6133c4ca886d7384c59cdb..69d4616183b3bf4dcdb04e5bfde8a137384bd35f 100644 (file)
@@ -334,7 +334,7 @@ int label_get_child_mls_label(int socket_fd, const char *exe, char **label) {
         }
 
         freecon(mycon);
-        mycon = context_str(bcon);
+        mycon = strdup(context_str(bcon));
         if (!mycon) {
                 r = -errno;
                 goto out;
@@ -348,6 +348,7 @@ int label_get_child_mls_label(int socket_fd, const char *exe, char **label) {
         }
 
         *label = ret;
+        ret = NULL;
         r = 0;
 
 out: