okbob / pspg

Unix pager (with very rich functionality) designed for work with tables. Designed for PostgreSQL, but MySQL is supported too. Works well with pgcli too. Can be used as CSV or TSV viewer too. It supports searching, selecting rows, columns, or block and export selected area to clipboard.
BSD 2-Clause "Simplified" License
2.45k stars 85 forks source link

Question about "safe_malloc()" function in /src/st_menu.c #175

Closed hyunji-Hong closed 3 years ago

hyunji-Hong commented 3 years ago

Dear team pspg, Hi,

I have a question, I wonder if the _safemalloc() function is safe. I found that it is not enough to handle exception of the malloc() function. Here is the reference: https://stackoverflow.com/posts/48043838/timeline

- if (!ptr)
+ if (!ptr && (size > 0))

Thanks :)

hyunji-Hong commented 3 years ago

Hi, I'm sorry, this is my mistake..