mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05: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:
parent
9d6ec1ee59
commit
819ea129af
@ -586,7 +586,7 @@ memorize_last_searched_bookmark(struct bookmark_search_ctx *ctx)
|
|||||||
/* Memorize last searched url */
|
/* Memorize last searched url */
|
||||||
mem_free_set(&bm_last_searched_url, stracpy(ctx->url));
|
mem_free_set(&bm_last_searched_url, stracpy(ctx->url));
|
||||||
if (!bm_last_searched_url) {
|
if (!bm_last_searched_url) {
|
||||||
mem_free(bm_last_searched_title);
|
mem_free_set(&bm_last_searched_title, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user