A string is duplicated in a few cases of the function "xvc_command_execute". But the memory will never be released after its use. I am missing the call "free(myfile)".
Does the source code show a memory leak?
It must be considered that the string can only be deleted if it was dynamically allocated before (case 1/2). There is a dependency with the input parameter "file" if this pointer is really connected with a constant.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Your approach seems still to be incomplete because of the "case 2" implementation. I recommend to store into a boolean variable if the free() call will be required.
I feel a bit uncomfortable with such handling for special cases.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm, another oversight ... grrr
anyway, since the issue here is that I either construct a filename or take the one passed, I should be able to compare the two pointers, hence:
$ svn diff -r 301:300 src/app_data.c
Index: src/app_data.c
===================================================================
--- src/app_data.c (Revision 301)
+++ src/app_data.c (Revision 300)
@@ -2703,9 +2703,12 @@
// sf-edit: flag 2
// gimp "${XVFILE}" &
- // in case we constructed a filename pattern, we need to free it again
- if (myfile != file)
- free ((void *) myfile);
+ switch (flag) {
+ case 1:
+ case 2:
+ free ((void *) myfile);
+ break;
+ }
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=782084
Originator: NO
quite probably in several instances. Been trying to track them down with valgrind but that doesn't seem to work well on gtk apps.
Logged In: YES
user_id=782084
Originator: NO
fixed in svn
Logged In: YES
user_id=572001
Originator: YES
Thanks.
http://xvidcap.svn.sourceforge.net/viewvc/xvidcap/trunk/src/app_data.c?r1=292&r2=298
Logged In: YES
user_id=572001
Originator: YES
It must be considered that the string can only be deleted if it was dynamically allocated before (case 1/2). There is a dependency with the input parameter "file" if this pointer is really connected with a constant.
Logged In: YES
user_id=782084
Originator: NO
done
Logged In: YES
user_id=572001
Originator: YES
I hope that I am not nitpicking too much.
http://xvidcap.svn.sourceforge.net/viewvc/xvidcap/trunk/src/app_data.c?r1=298&r2=300
Your approach seems still to be incomplete because of the "case 2" implementation. I recommend to store into a boolean variable if the free() call will be required.
I feel a bit uncomfortable with such handling for special cases.
Logged In: YES
user_id=782084
Originator: NO
Hmm, another oversight ... grrr
anyway, since the issue here is that I either construct a filename or take the one passed, I should be able to compare the two pointers, hence:
$ svn diff -r 301:300 src/app_data.c
Index: src/app_data.c
===================================================================
--- src/app_data.c (Revision 301)
+++ src/app_data.c (Revision 300)
@@ -2703,9 +2703,12 @@
// sf-edit: flag 2
// gimp "${XVFILE}" &
- // in case we constructed a filename pattern, we need to free it again
- if (myfile != file)
- free ((void *) myfile);
+ switch (flag) {
+ case 1:
+ case 2:
+ free ((void *) myfile);
+ break;
+ }
Logged In: YES
user_id=572001
Originator: YES
Thanks.