linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "man 3 vsprintf" : simple bug in EXAMPLE section
@ 2015-03-27  5:27 Zhen Ren
       [not found] ` <551584DE020000D400069A4C-8qcz4lDFMZvD8XXLLHKrIiOjQekVJEpY@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Zhen Ren @ 2015-03-27  5:27 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hi,
There is simple bug in EXAMPLE section of "man 3 vsprintf".

Function will return nothing if  it steps into the last "else {}".

------------------ example code -----------------
 char *
       make_message(const char *fmt, ...)
       {
           int n;
           int size = 100;     /* Guess we need no more than 100 bytes */
           char *p, *np;
           va_list ap;
.
cut off
.
               np = realloc(p, size);
               if (np == NULL) {
                   free(p);
                   return NULL;
               } else {
                   p = np;
+                return p;
               }
           }
       }
------------------------------------------------


--
Best regards,
Eric, Ren
HA team, SUSE


--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-11  7:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-27  5:27 "man 3 vsprintf" : simple bug in EXAMPLE section Zhen Ren
     [not found] ` <551584DE020000D400069A4C-8qcz4lDFMZvD8XXLLHKrIiOjQekVJEpY@public.gmane.org>
2015-03-27  6:06   ` Michael Kerrisk (man-pages)
     [not found]     ` <CAKgNAkjY=YpuZ7ifA1HCN68jZZ_PgFRw4KYfKaXeViPAvs+m+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-27  9:52       ` Zhen Ren
     [not found]         ` <5515C2F9020000D400069A6F-8qcz4lDFMZvD8XXLLHKrIiOjQekVJEpY@public.gmane.org>
2015-03-27 10:20           ` walter harms
     [not found]             ` <55152F0A.7090708-fPG8STNUNVg@public.gmane.org>
2015-03-27 15:26               ` Zhen Ren
2015-04-11  7:30               ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).