After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747361 - Fix file_transfer() leak
Fix file_transfer() leak
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2015-04-05 09:36 UTC by Christophe Fergeau
Modified: 2015-04-10 08:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Always set 'path2_out' value in create_proxy_for_file2 (1.46 KB, patch)
2015-04-05 09:36 UTC, Christophe Fergeau
accepted-commit_now Details | Review
Fix 'path[12]_out' leak in file_transfer() (893 bytes, patch)
2015-04-05 09:36 UTC, Christophe Fergeau
accepted-commit_now Details | Review

Description Christophe Fergeau 2015-04-05 09:36:27 UTC
valgrind reported a leak in file_transfer() in gvfs, these 2 patches fix it.
Comment 1 Christophe Fergeau 2015-04-05 09:36:31 UTC
Created attachment 300975 [details] [review]
Always set 'path2_out' value in create_proxy_for_file2

create_proxy_for_file2() will only set the *path2_out return value if a
mount info was found for the 'file2' argument. However, as this return
value must be freed, it's much better to set 'path2_out' to NULL rather
than leave it unset. This way the caller can call g_free() on the
returned value without having to set 'path2_out' to NULL before calling
create_proxy_for_file2.
Comment 2 Christophe Fergeau 2015-04-05 09:36:38 UTC
Created attachment 300976 [details] [review]
Fix 'path[12]_out' leak in file_transfer()

file_transfer() calls create_proxy_for_file2() passing it 'path1_out'
and 'path2_out' arguments. These return values are newly allocated
strings, so they must be freed when no longer used. This fixes a leak
reported by valgrind.
Comment 3 Ross Lagerwall 2015-04-05 15:43:48 UTC
Review of attachment 300975 [details] [review]:

ok
Comment 4 Ross Lagerwall 2015-04-05 15:44:00 UTC
Review of attachment 300976 [details] [review]:

ok
Comment 5 Christophe Fergeau 2015-04-10 08:33:24 UTC
Attachment 300975 [details] pushed as 4912a67 - Always set 'path2_out' value in create_proxy_for_file2
Attachment 300976 [details] pushed as d59e687 - Fix 'path[12]_out' leak in file_transfer()