From 20b181d678ad167395ab4c9f969c8517863fd73f Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 23 Apr 2011 13:54:08 -0500 Subject: [PATCH 07/18] Fix segfault --- src/core/rosters.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/src/core/rosters.c +++ b/src/core/rosters.c @@ -140,6 +140,7 @@ resource->status = NULL; resource->composing_id = NULL; resource->pgp_keyid = NULL; + resource->pgp_encrypt = 0; return resource; } @@ -518,7 +519,7 @@ free(send_to_gpg); /* If there is a good signature, grab the key ID */ - if(strstr(from_gpg, "Good signature from")) { + if(from_gpg && strstr(from_gpg, "Good signature from")) { char *s = strstr(from_gpg, "key ID "); if(s) { pgp_keyid = malloc(sizeof(*pgp_keyid)*9); @@ -526,7 +527,7 @@ pgp_keyid[8] = '\0'; } } - free(from_gpg); + if(from_gpg) free(from_gpg); } update_user_presence(server, from, node_show != NULL ? node_show->value : NULL, status,