Re: Trying to support Python 3 but fails on libsemanage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 26, 2012 at 12:44 PM, Sven Vermeulen
<sven.vermeulen@xxxxxxxxx> wrote:
> On Wed, May 23, 2012 at 10:35:19PM +0200, Sven Vermeulen wrote:
> diff -ur libsemanage-2.1.6.orig/src/fcontext_record.c libsemanage-2.1.6/src/fcontext_record.c
> --- libsemanage-2.1.6.orig/src/fcontext_record.c        2012-05-22 21:50:23.416071391 +0200
> +++ libsemanage-2.1.6/src/fcontext_record.c     2012-05-26 09:08:22.125114161 +0200
> @@ -45,7 +45,11 @@
>                    "create file context key");
>                return STATUS_ERR;
>        }
> -       tmp_key->expr = expr;
> +       tmp_key->expr = strdup(expr);
> +       if (!tmp_key->expr) {
> +               ERR(handle, "out of memory, could not create file context key.");
> +               return STATUS_ERR;
> +       }
>        tmp_key->type = type;
>
>        *key_ptr = tmp_key;
> @@ -74,6 +79,7 @@
>
>  void semanage_fcontext_key_free(semanage_fcontext_key_t * key)
>  {
> +       free(key->expr);
>        free(key);
>  }

key->expr is a const char * so free() is not 'allowed'.  I changed it
to just a char * (which is what strdup returns) so the code could
build.  Thanks!

-Eric


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


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux