staging: greybus: loopback_test: fix device-name lea
PATCH v3 1/1 staging: greybus: loopback_test: fix device-name lea
All the device names were being always leaked. Also, illegal free was being called upon namelist[n] which was coincidentally NULL. The pointer to dirent structures must be individually freed before freeing the pointer array.
Coccinelle Script:
@@
expression arr,ex1,ex2;
@@
for(ex1 = 0; ex1 < ex2; ex1++) { <...
arr[
- ex2
+ ex1
]
...> }
---
Changes in v3:
-Edited the commit message.
Changes in v2:
-Made the commit message clearer.
--- drivers/staging/greybus/tools/loopback_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/tools/loopback_test.c +1 -1
@@ -636,7 +636,7 @@ int find_loopback_devices(struct loopback_test *t) ret =0 ; done:for (i =0 ; i < n; i++) -free (namelist[n]); +free (namelist[i]);free (namelist); baddir:return ret;
Signature · 1 line
2.7.4
lea -> leak in the subject line.
Actually, Johan said that you could add his Reviewed-by tage if you resend. You could put that under your Signed-off-by. Name and email, just like for your name.
julia
Quoted 50 lines · Gargi Sharma
All the device names were being always leaked. Also, illegal free was being called upon namelist[n] which was coincidentally NULL. The pointer to dirent structures must be individually freed before freeing the pointer array.
Coccinelle Script:
@@
expression arr,ex1,ex2;
@@for(ex1 = 0; ex1 < ex2; ex1++) { <...
arr[
- ex2
+ ex1
]
...> }Signed-off-by Gargi Sharma <[email protected]>---
Changes in v3:
-Edited the commit message.
Changes in v2:
-Made the commit message clearer.--- drivers/staging/greybus/tools/loopback_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/greybus/tools/loopback_test.c +1
-2@@ -636,7 +636,7 @@ int find_loopback_devices(struct loopback_test *t) ret =0 ; done:for (i =0 ; i < n; i++) -free (namelist[n]); +free (namelist[i]);free (namelist); baddir:return ret; --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1487777111-7267-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.