You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "royfengsss (via GitHub)" <gi...@apache.org> on 2023/08/03 01:09:32 UTC

[GitHub] [nuttx] royfengsss opened a new pull request, #10017: Use `lib_free` for the memory buffer allocated via `strdup` in `net/procfs/net_procfs.c`

royfengsss opened a new pull request, #10017:
URL: https://github.com/apache/nuttx/pull/10017

   ## Summary
   In `net/procfs/net_procfs.c` the memory buffer of `copy` is allocated in `strdup`, which used `lib_malloc`.
   It need to be freeed with `lib_free`
   Otherwise, it will triger the assertion of "Free memory from the wrong heap" under flatmode and user seperated heap enabled case.
   
   ## Impact
   Fix a mismatch of malloc/free.
   
   ## Testing
   Pass the build, test with assertion enabled. no related assertion found anymore.
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 closed pull request #10017: Use `lib_free` for the memory buffer allocated via `strdup` in `net/procfs/net_procfs.c`

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 closed pull request #10017: Use `lib_free` for the memory buffer allocated via `strdup` in `net/procfs/net_procfs.c`
URL: https://github.com/apache/nuttx/pull/10017


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #10017: Use `lib_free` for the memory buffer allocated via `strdup` in `net/procfs/net_procfs.c`

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #10017:
URL: https://github.com/apache/nuttx/pull/10017#discussion_r1283610498


##########
net/procfs/net_procfs.c:
##########
@@ -244,7 +246,7 @@ static int netprocfs_open(FAR struct file *filep, FAR const char *relpath,
 
       devname = basename(copy);
       dev     = netdev_findbyname(devname);
-      kmm_free(copy);
+      lib_free(copy);

Review Comment:
   @royfengsss see this patch: https://github.com/apache/nuttx/pull/10066



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on pull request #10017: Use `lib_free` for the memory buffer allocated via `strdup` in `net/procfs/net_procfs.c`

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #10017:
URL: https://github.com/apache/nuttx/pull/10017#issuecomment-1666797292

   Don't need this patch after https://github.com/apache/nuttx/pull/10066, let's close it


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #10017: Use `lib_free` for the memory buffer allocated via `strdup` in `net/procfs/net_procfs.c`

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #10017:
URL: https://github.com/apache/nuttx/pull/10017#discussion_r1282560712


##########
net/procfs/net_procfs.c:
##########
@@ -244,7 +246,7 @@ static int netprocfs_open(FAR struct file *filep, FAR const char *relpath,
 
       devname = basename(copy);
       dev     = netdev_findbyname(devname);
-      kmm_free(copy);
+      lib_free(copy);

Review Comment:
   but, procfs is always bundled in the kernel image, so lib_malloc in strdup is always mapped to kmm_malloc.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org