update_image.c: Fix memory leak in error path
authorEric Biggers <ebiggers3@gmail.com>
Thu, 15 May 2014 03:15:59 +0000 (22:15 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 15 May 2014 03:15:59 +0000 (22:15 -0500)
src/update_image.c

index 14f3163..af784f9 100644 (file)
@@ -401,8 +401,10 @@ journaled_change_name(struct update_command_journal *j,
        prim.name.subject = dentry;
        prim.name.old_name = dentry->file_name;
        ret = record_update_primitive(j, prim);
-       if (ret)
+       if (ret) {
+               FREE(new_name);
                return ret;
+       }
 
        dentry->file_name = new_name;
        dentry->file_name_nbytes = new_name_nbytes;