From 31b2a6ffa839ad107706516e166f13b0b88bae08 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 25 Feb 2013 13:38:18 -0800 Subject: [PATCH] Fix uninitialized memory access in webservice download In download_dialog_release_xml() we check if state->xmldata is non-NULL and free it. But we don't set it to NULL anywhere, so if the user hits cancel the variable is undefined. Signed-off-by: Dirk Hohndel --- webservice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webservice.c b/webservice.c index f3def9f14..d52d480ec 100644 --- a/webservice.c +++ b/webservice.c @@ -218,7 +218,7 @@ void webservice_download_dialog(void) const gchar *current_uid = subsurface_get_conf("webservice_uid"); GtkWidget *dialog, *vbox, *status, *info, *uid; GtkWidget *frame_uid, *frame_status, *download, *image, *apply; - struct download_dialog_state *state = malloc(sizeof(struct download_dialog_state)); + struct download_dialog_state *state = calloc(1, sizeof(struct download_dialog_state)); gboolean has_previous_uid = TRUE; if (!current_uid) {