Merge lp:~luszczyk/sakura/reviews into lp:~dabisu/sakura/sakura

Proposed by Michał Łuszczyk
Status: Merged
Approved by: David Gómez
Approved revision: 331
Merge reported by: David Gómez
Merged at revision: not available
Proposed branch: lp:~luszczyk/sakura/reviews
Merge into: lp:~dabisu/sakura/sakura
Diff against target: 31 lines (+7/-3)
1 file modified
src/sakura.c (+7/-3)
To merge this branch: bzr merge lp:~luszczyk/sakura/reviews
Reviewer Review Type Date Requested Status
David Gómez Approve
Review via email: mp+38554@code.launchpad.net

Description of the change

Fixed an error, that causes SEGFAULT when calling sakura_error with few arguments, e.g. when no browser is found in sakura_open_url.

To post a comment you must log in.
lp:~luszczyk/sakura/reviews updated
331. By Michał Łuszczyk

Freeing allocated memory

Revision history for this message
David Gómez (dabisu) wrote :

Thanks! Sorry for the delay

Revision history for this message
David Gómez (dabisu) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/sakura.c'
2--- src/sakura.c 2010-10-06 13:45:12 +0000
3+++ src/sakura.c 2010-10-19 19:14:02 +0000
4@@ -229,6 +229,7 @@
5 #define DEFAULT_PASTE_KEY GDK_V
6 #define DEFAULT_SCROLLBAR_KEY GDK_S
7 #define DEFAULT_FULLSCREEN_KEY GDK_F11
8+#define ERROR_BUFFER_LENGTH 256
9 const char cfg_group[] = "sakura";
10
11 static GQuark term_data_id = 0;
12@@ -2403,15 +2404,18 @@
13 {
14 GtkWidget *dialog;
15 va_list args;
16+ char* buff;
17
18 va_start(args, format);
19+ buff = malloc(sizeof(char)*ERROR_BUFFER_LENGTH);
20+ vsnprintf(buff, sizeof(char)*ERROR_BUFFER_LENGTH, format, args);
21+ va_end(args);
22
23 dialog = gtk_message_dialog_new(GTK_WINDOW(sakura.main_window), GTK_DIALOG_DESTROY_WITH_PARENT,
24- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, format, args);
25+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", buff);
26 gtk_dialog_run (GTK_DIALOG (dialog));
27-
28- va_end(args);
29 gtk_widget_destroy (dialog);
30+ free(buff);
31 }
32
33

Subscribers

People subscribed via source and target branches