[augeas-devel] [PATCH] Fix use of uninitialized pointer

David Lutterkort dlutter at redhat.com
Thu May 22 20:19:05 UTC 2008


1 file changed, 4 insertions(+), 4 deletions(-)
src/transform.c |    8 ++++----


# HG changeset patch
# User David Lutterkort <dlutter at redhat.com>
# Date 1211487530 25200
# Node ID 38c46290bfc585f8ff5628d8f299d788031d83fb
# Parent  60026e5ce5ce66ddf4aacb0eed156a3fff9efa24
Fix use of uninitialized pointer

ERR must be initialized, since it is later passed to free_lns_error

diff -r 60026e5ce5ce -r 38c46290bfc5 src/transform.c
--- a/src/transform.c	Thu May 22 10:29:17 2008 -0700
+++ b/src/transform.c	Thu May 22 13:18:50 2008 -0700
@@ -384,19 +384,19 @@ int transform_save(struct augeas *aug, s
     char *text = NULL;
     const char *filename = path + strlen(AUGEAS_FILES_TREE) + 1;
     const char *err_status = NULL;
-    struct lns_error *err;
+    struct lns_error *err = NULL;
     int result = -1;
 
     if (asprintf(&augorig, "%s%s", aug->root, filename) == -1) {
         augorig = NULL;
         goto done;
     }
-    
+
     if (asprintf(&augnew, "%s%s" EXT_AUGNEW, aug->root, filename) == -1) {
         augnew = NULL;
         goto done;
     }
-    
+
     if (access(augorig, R_OK) == 0) {
         text = read_file(augorig);
     } else {
@@ -437,7 +437,7 @@ int transform_save(struct augeas *aug, s
                 augsave = NULL;
                 goto done;
             }
-            
+
             if (rename(augorig, augsave) != 0) {
                 err_status = "rename_augsave";
                 goto done;




More information about the augeas-devel mailing list