xiaoxiang781216 commented on code in PR #3130:
URL: https://github.com/apache/nuttx-apps/pull/3130#discussion_r2235496579


##########
examples/mtdpart/mtdpart_main.c:
##########
@@ -530,19 +490,41 @@ int main(int argc, FAR char *argv[])
             {
               printf("ERROR: Bad value %lu, expected %lu\n",
                      (long)buffer[k], (long)(~check));
-              fflush(stdout);
-              exit(27);
+              status = 23;
+              goto err_rw;
             }
 
           check += sizeof(uint32_t);
         }
     }
 
-  close(fd);
+  status = 0;
 
   /* And exit without bothering to clean up */
 
   printf("PASS: Everything looks good\n");
+
+err_rw:

Review Comment:
   ```suggestion
   err_fd:
   ```



##########
examples/mtdpart/mtdpart_main.c:
##########
@@ -530,19 +490,41 @@ int main(int argc, FAR char *argv[])
             {
               printf("ERROR: Bad value %lu, expected %lu\n",
                      (long)buffer[k], (long)(~check));
-              fflush(stdout);
-              exit(27);
+              status = 23;
+              goto err_rw;
             }
 
           check += sizeof(uint32_t);
         }
     }
 
-  close(fd);
+  status = 0;
 
   /* And exit without bothering to clean up */
 
   printf("PASS: Everything looks good\n");
+
+err_rw:
+  close(fd);
+
+err_fd:
+  free(buffer);
+
+err_buf:

Review Comment:
   remove



##########
examples/mtdpart/mtdpart_main.c:
##########
@@ -530,19 +490,41 @@ int main(int argc, FAR char *argv[])
             {
               printf("ERROR: Bad value %lu, expected %lu\n",
                      (long)buffer[k], (long)(~check));
-              fflush(stdout);
-              exit(27);
+              status = 23;
+              goto err_rw;
             }
 
           check += sizeof(uint32_t);
         }
     }
 
-  close(fd);
+  status = 0;
 
   /* And exit without bothering to clean up */
 
   printf("PASS: Everything looks good\n");
+
+err_rw:
+  close(fd);
+
+err_fd:

Review Comment:
   ```suggestion
   err_buf:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to