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 10:47:47 +0000 |
commit | e3f15780c8197a66bfb620b802ba18d0ba0dd2ce (patch) | |
tree | 1008f29e44a4a1b816a73b629b4a382c2f10ca1e | |
parent | 6e703c1316548e42b5133ba508fe0e7d090ac3d0 (diff) | |
download | libguestfs-e3f15780c8197a66bfb620b802ba18d0ba0dd2ce.tar.gz libguestfs-e3f15780c8197a66bfb620b802ba18d0ba0dd2ce.tar.xz libguestfs-e3f15780c8197a66bfb620b802ba18d0ba0dd2ce.zip |
daemon: Fix crash in aug-defnode (RHBZ#785668).
-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 |