speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] Connect to socket if SPEECHD_ADDRESS begins with /


From: Trevor Saunders
Subject: [PATCH 3/3] Connect to socket if SPEECHD_ADDRESS begins with /
Date: Wed, 25 Jul 2012 08:08:55 -0400

> I solved it by fputs a message on stderr and exiting, since handling stdup
> malloc failure by strdup'ing an error string (and returning from the function)
> is like to take out a fire with matches :-) I read somewhere that malloc
> failures basically should be handled by exit() since when the memory is out
> the system must already be in such bad state that there is very little you 
> can do.

I'd say that's true as a first approximation, but the real story is a
bit more complicated, mostly because of various factors that could
channge things such as say a custom malloc, or allocation of buffers
that may accidentally be huge.

> Also that is what g_strdup (and any function using g_malloc) does.

yes, I think the real write patch here may be to not copy the string in
the first place which I looked into at one point, but it was kind of
tricky.

> Please let me know if you agree with such a way so that I can post
> such a patch for final review.

In an ideal world I don't think libspeechd would just exit from someone
elses program, but for know that's probably fine.

Trev

> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd



reply via email to

[Prev in Thread] Current Thread [Next in Thread]