1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

Bookmarks: Avoid a dangling pointer on malloc failure

In memorize_last_searched_bookmark, when malloc of bm_last_searched_url
fails, set bm_last_searched_title to NULL after freeing it.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-06-06 05:08:01 +00:00 committed by Miciah Dashiel Butler Masters
parent 9d6ec1ee59
commit 819ea129af

View File

@ -586,7 +586,7 @@ memorize_last_searched_bookmark(struct bookmark_search_ctx *ctx)
/* Memorize last searched url */
mem_free_set(&bm_last_searched_url, stracpy(ctx->url));
if (!bm_last_searched_url) {
mem_free(bm_last_searched_title);
mem_free_set(&bm_last_searched_title, NULL);
return 0;
}