isl_stream_new_str: check result of allocation
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 25 Jun 2010 14:59:14 +0000 (16:59 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 26 Jun 2010 15:37:38 +0000 (17:37 +0200)
isl_stream.c

index 3629610..c917fb8 100644 (file)
@@ -140,9 +140,11 @@ struct isl_stream* isl_stream_new_file(struct isl_ctx *ctx, FILE *file)
 
 struct isl_stream* isl_stream_new_str(struct isl_ctx *ctx, const char *str)
 {
-    struct isl_stream *s = isl_stream_new(ctx);
-    s->str = str;
-    return s;
+       struct isl_stream *s = isl_stream_new(ctx);
+       if (!s)
+               return NULL;
+       s->str = str;
+       return s;
 }
 
 static int isl_stream_getc(struct isl_stream *s)