On 05/04/14 21:50, Jean-Philippe Ouellet wrote:
On Sun, May 04, 2014 at 12:17:16PM -0600, Theo de Raadt wrote:
We are going to completely ignore diffs which change multiple idioms
at once.
Okay.
That is how mistakes get made.
Yep, more true than I realized.
Here's a simpler one:
Index: apps.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/apps/apps.c,v
retrieving revision 1.45
diff -u -p -r1.45 apps.c
--- apps.c 3 May 2014 16:03:54 -0000 1.45
+++ apps.c 4 May 2014 19:35:59 -0000
@@ -209,13 +209,10 @@ chopup_args(ARGS * arg, char *buf, int *
*argc = 0;
*argv = NULL;
- i = 0;
if (arg->count == 0) {
arg->count = 20;
- arg->data = (char **)malloc(sizeof(char *) * arg->count);
+ arg->data = calloc(arg->count, sizeof(char *));
}
- for (i = 0; i < arg->count; i++)
- arg->data[i] = NULL;
General question; Given that NULL theoretically could be != 0, and that
we generally compare e.g. the malloc() result to NULL specifically, is
this approach acceptable?
/Alexander