Various memory leaks, hazardous frees, untranslated strings and wrong return values
I did a small source code audit and found following minor bugs. They are not important enough to deserve dedicated bug reports, so let's put them in a juicy meta bug.
ringwelcomeview:
-
memory leak
-
ring_welcome_update_view()
does not freering_id
properly -
render_account_avatar()
leaks id. -
return value
-
draw_qrcode()
should return FALSE if we failed to generate a qrcode.
usernameregistrationbox:
-
l18n
-
"Enter the password of your Ring account" is not translated in
button_register_username_clicked()
.
ringnotify:
-
free not allocated memory
-
~RingNotifyServerInfo()
frees name, vendor, etc. but those are only allocated ifUSE_LIBNOTIFY
is defined. If not, this is undefined behavior and might very well end up crashing. Same ifnotify_get_server_info()
returns FALSE. -
return value
-
ring_hide_notification()
always returns FALSE.
video_widget:
-
memory leak
-
potential list leak in case of error in
video_widget_on_drag_data_received()
-
free not allocated memory
-
in
switch_video_input_file()
: uri might be NULL even if the answer of the dialog is GTK_RESPONSE_ACCEPT. We should check before freeing
ring_client:
-
memory leak
-
ring_client_open()
does not free call_id properly. -
ring_client_open()
leaks the result ofg_file_get_uri_scheme(*file)
, which is never freed properly.
webkitchatcontainer:
-
return value
-
webview_chat_context_menu()
always returns false. -
invalid casts
-
webkit_chat_container_execute_js
should take const char* instead of char* (invalid const char* to char* cast otherwise)
ringmainwindow:
-
memory leak
-
multiple memory leaks in
print_account_and_state()
-
on_clear_all_history_foreach()
leaks account_id -
changeAccountSelection()
leaks account_id -
dead code
-
on_save_accounts_timeout()
is defined but not used. -
on_show_add_account()
is defined but not used. -
several defined but unused variables
-
several defined but unused parameters
-
bad printf formatter
-
multiple places where char* is passed to printf-style function with %i formatter