forked from Ivasoft/DSView
Replace g_try_malloc to malloc
This commit is contained in:
@@ -271,11 +271,17 @@ static gboolean parse_header(FILE *file, struct context *ctx)
|
||||
else
|
||||
{
|
||||
sr_info("Probe %d is '%s' identified by '%s'.", ctx->probecount, parts[3], parts[2]);
|
||||
probe = g_malloc(sizeof(struct probe));
|
||||
probe->identifier = g_strdup(parts[2]);
|
||||
probe->name = g_strdup(parts[3]);
|
||||
ctx->probes = g_slist_append(ctx->probes, probe);
|
||||
ctx->probecount++;
|
||||
probe = malloc(sizeof(struct probe));
|
||||
|
||||
if (probe != NULL){
|
||||
probe->identifier = g_strdup(parts[2]);
|
||||
probe->name = g_strdup(parts[3]);
|
||||
ctx->probes = g_slist_append(ctx->probes, probe);
|
||||
ctx->probecount++;
|
||||
}
|
||||
else{
|
||||
sr_err("%s,ERROR:failed to alloc memory.", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev(parts);
|
||||
@@ -324,7 +330,7 @@ static int init(struct sr_input *in, const char *filename)
|
||||
|
||||
(void)filename;
|
||||
|
||||
if (!(ctx = g_try_malloc0(sizeof(*ctx)))) {
|
||||
if (!(ctx = malloc(sizeof(struct context)))) {
|
||||
sr_err("Input format context malloc failed.");
|
||||
return SR_ERR_MALLOC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user