diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-01-30 10:47:47 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-01-30 11:26:27 +0000 |
commit | ee51e422d779ad0641ea80e5aa8d82e62ff430bc (patch) | |
tree | dfbd88a0f1298eb621247da5f0f07cba26e732a1 | |
parent | 3350b7260b59cade7a573c727f5f3dbaa0914de5 (diff) | |
download | libguestfs-ee51e422d779ad0641ea80e5aa8d82e62ff430bc.tar.gz libguestfs-ee51e422d779ad0641ea80e5aa8d82e62ff430bc.tar.xz libguestfs-ee51e422d779ad0641ea80e5aa8d82e62ff430bc.zip |
daemon: Fix crash in aug-defnode (RHBZ#785668).
(cherry picked from commit e3f15780c8197a66bfb620b802ba18d0ba0dd2ce)
-rw-r--r-- | daemon/augeas.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/daemon/augeas.c b/daemon/augeas.c index 83d24ad3..f52c091a 100644 --- a/daemon/augeas.c +++ b/daemon/augeas.c @@ -141,18 +141,27 @@ guestfs_int_int_bool * do_aug_defnode (const char *name, const char *expr, const char *val) { #ifdef HAVE_AUG_DEFNODE - static guestfs_int_int_bool r; - int created; + guestfs_int_int_bool *r; + int i, created; NEED_AUG (NULL); - r.i = aug_defnode (aug, name, expr, val, &created); - if (r.i == -1) { + i = aug_defnode (aug, name, expr, val, &created); + if (i == -1) { reply_with_error ("Augeas defnode failed"); return NULL; } - r.b = created; - return &r; + + r = malloc (sizeof *r); + if (r == NULL) { + reply_with_perror ("malloc"); + return NULL; + } + + r->i = i; + r->b = created; + + return r; #else NOT_AVAILABLE (NULL); #endif |